PixelPAD 2D - animation

new_animation(sprite: sprite, fps: int, start: int, end: int) -> animation

Example
Description
Create a new animation object from the provided sprite sheet.
Parameters
sprite
The sprite object to create the animation from. A sprite object is created from new_sprite(uri)

fps
The frame rate of the animation.

start
The frame number of the sprite sheet to start the animation from. 0 is the top left corner, with numbers increasing to the right and downwards.

end
The frame number of the sprite sheet to end the animation on. 0 is the top left corner, with numbers increasing to the right and downwards.

Return
A new animation object that plays frames from start to end at a rate of fps.

set_animation(obj: gameobject, anim: animation) -> None

Example
Description
Set the current animation of the game object obj to the animation anim. Does nothing if the animation is already set on the object.
Parameters
obj
The GameObject instance to set the animation for. Can use self

anim
The animation object to set.

Return
No return value

Animation

Animations are what lets us make our sprites move. To make animations you use something called a “sprite sheet”. Sprite sheets are when you take multiple sprites, put them inside of one sprite and then get the game, in this case PixelPAD2D to break the images up for us turning them into frame(s). Then once you do that you can tell the engine to animate our objects for us by looping quickly through specific frames. Check out the methods and examples below for more.
Company
Resources
Contact Us