femto.Sprite - felipemanga/FemtoIDE GitHub Wiki
Summary
Sprites can be drawn on the screen and support animation and transparency.
Utilization
The IDE automatically generates classes that extend Sprite whenever you import an animated image.
Currently, Aseprite json spritesheets are the only format supported.
For each animation in the json, a method that plays it is created. In other words, if your spritesheet has a "run" animation, the imported Sprite will have a run()
method. Animations are updated automatically whenever draw
is called.
Example, given that images/Dog.json
is a spritesheet exported from Aseprite:
import images.Dog; ... Dog dog = new Dog(); dog.run(); dog.draw(screen);
Methods
void [animation name]()
starts playing an animation. Does nothing if that animation is already playing.void draw(HiRes16Color screen)
Updates the animation and draws onto the screen.void setPosition(float x, float y)
Sets the position of the sprite.void setStatic(boolean static)
If set to true, the sprite's position will not be affected by the screen's camera offset. Meant for HUD elements.void setMirrored(boolean mirrored)
If set to true, the sprite will appear mirrored.void setFlipped(boolean flipped)
If set to true, the sprite will sprout rainbows