DEPRECATION NOTE:
h2d.Sprite
is nowh2d.Object
. Sprite type is still accessible but is actually a typedef ofh2d.Object
in the API. It has been kept for compatibility reasons.
The following documentation is not maintained.
The following properties and methods can be accessed on any Sprite:
x
andy
: the position in pixels relative to the parent Sprite (or in the Scene)rotation
: the rotation of the sprite in radiansscaleX
andscaleY
: the horizontal and vertical scaling values for this Sprite (default to (1,1)). You can uniformaly increase the current scales by calling sprite.scale(1.1) or set them to give value by using sprite.setScale(value).visible
: when visible is set to false, a sprite is still updated (position is calculated and animation still plays) but the sprite and all its children are not displayedparent
: the current parent Sprite, or null if it has not been addedremove()
: remove the sprite from its parent. This will prevent it from being updated and displayedaddChild()
: adds the specified sprite to the children listfor( s in sprite ) {...}
: iterates over all the current children
Sprite instances have other properties and methods which can be discovered by visiting the h2d.Sprite
API section.