sprite.setUV

Section: Sprite 2D

What it does

sprite.setUV sets UV on a sprite object. It takes id, u1, v1, u2 and v2.

Signature

sprite.setUV(id, u1, v1, u2, v2)

Arguments

  • id
  • u1
  • v1
  • u2
  • v2

Example · generated

function start() {  const id = sprite.create('/sprites/hero.png', 100, 120);  sprite.setUV(id, 0, 120, 0, 120);}

sprite.create is there to give the call something to act on; sprite.setUV is the line that matters. The code sits in start(), which the engine calls once, when the entity spawns.

49 members in sprite