sprite(spr: string | SpriteData | Asset, opt?: SpriteCompOpt): SpriteComp
Attach and render a sprite to a Game Object.
param
spr- The sprite to render.
param
opt- Options for the sprite component. See
// minimal setup add([ sprite("bean"), ]) // with options const bean = add([ sprite("bean", { // start with animation "idle" anim: "idle", }), ]) // play / stop an anim bean.play("jump") bean.stop() // manually setting a frame bean.frame = 3
returns
The sprite comp.
since
v2000.0