-
Notifications
You must be signed in to change notification settings - Fork 59
Lua API: Sprites
Sprites allow you to interface with HaxeFlixel's "FlxSprite" class. Many classes, such as Receptor and Character, inherit from this.
Property | Value Type | Description |
---|---|---|
spriteName | string | Used internally. Read-only. |
x | number | The sprite's x position. Equivilant to FlxSprite.y |
y | number | The sprite's y position. Equivilant to FlxSprite.x |
alpha | number | The sprite's transparency, where 1 is fully opaque and 0 is fully transparent. Equivilant to FlxSprite.alpha |
angle | number | The sprite's angle in degrees. Equivilant to FlxSprite.angle |
width | number | The sprite's hitbox's width. Equivilant to FlxSprite.width |
height | number | The sprite's hitbox's height. Equivilant to FlxSprite.height |
scrollFactorX | number | The sprite's horizontal paralaxing. Equivilant to FlxSprite.scrollFactor.x |
scrollFactorY | number | The sprite's vertical paralaxing. Equivilant to FlxSprite.scrollFactor.y |
scaleX | number | The sprite's horizontal scale. Equivilant to FlxSprite.scale.x |
scaleY | number | The sprite's vertical scale. Equivilant to FlxSprite.scale.y |
antialiasing | bool | Whether the sprite should have antialiasing or not. Equivilant to FlxSprite.antialiasing |
active | bool | Whether the sprite should call the associated FlxSprite's update function in HaxeFlixel. Equivilant to FlxSprite.active |
visible | bool | The sprite's visibility. Equivilant to FlxSprite.visible |
flipX | bool | Flips the sprite horizontally. Equivilant to FlxSprite.flipX |
flipY | bool | Flips the sprite vertically. Equivilant to FlxSprite.flipY |
Sets the scale of the sprite.
Tweens the properties to the specified value over the specified length. easingStyle names can be found at https://api.haxeflixel.com/flixel/tweens/FlxEase.html
Note that the property names must be FlxSprite property names, not Sprite property names ("scrollFactor.x" instead of "scrollFactorX")
Centers the screen on the specified axes.
Valid axes are "X", "Y" and "XY"
Returns the sprite's new X and Y position.
Returns the associated FlxSprite's property's value.
Sets the associated FlxSprite's frames property to the Sparrow Atlas at the path.
Note that the path is localized at the song's folder!
void
addAnimByPrefix(string
name, string
prefix, number
frameRate=24, bool
looped=true, bool
flipX=false, bool
flipY=false)
Equivilant to FlxSprite.animation.addByPrefix. Make sure you use setFrames
before using this!
void
addAnimByIndices(string
name, string
prefix, Array<number>
indices, number
frameRate=24, bool
looped=true, bool
flipX=false, bool
flipY=false)
Equivilant to FlxSprite.animation.addByIndices. Make sure you use setFrames
before using this!
void
addAnim(string
name, Array<number>
frames, number
frameRate=24, bool
looped=true, bool
flipX=false, bool
flipY=false)
Equivilant to FlxSprite.animation.add.
Equivilant to FlxSprite.loadGraphic
Note that the path is localized to the song's folder!
Changes the animation's framerate to newFramerate.
Returns if the animation is registered on the sprite
Plays an animation on the sprite. Equivilant to FlxSprite.animation.play