Version2.0/Sprites
Last-modified: 2009-03-28 (土) 15:22:33
- Sprite Sprite.new(path, frameWidth, frameHeight, dest)
Create a sprite from an image file
path (String): path of the file which contains the sprite
frameWidth (Number): width of the frames
frameHeight (Number): height of the frames
dest (Number): destination (RAM or VRAM)
- Void sprite:drawFrame(screen, x, y, nbFrame)
Draw a frame of the sprite
screen (Number): screen (SCREEN_UP or SCREEN_DOWN)
x (Number): X-coordinate where to draw the frame
y (Number): Y-coordinate where to draw the frame
nbFrame (Number): number of the frame to draw
- Void sprite:addAnimation(tabAnim, delay)
Create an animation
tabAnim (Table): the table of the animation frames
delay (Number): delay between each frame
- Void sprite:playAnimation(screen, x, y, nbAnim)
Play an animation on the screen
screen (Number): screen (SCREEN_UP or SCREEN_DOWN)
x (Number): X-coordinate where to draw the frame
y (Number): Y-coordinate where to draw the frame
nbAnim (Number): number of the animation to play
- Void sprite:resetAnimation(nbAnim)
Reset an animation
nbAnim (Number): number of the animation
- Void sprite:startAnimation(nbAnim)
Start an animation
nbAnim (Number): number of the animation
- Void sprite:stopAnimation(nbAnim)
Stop an animation
nbAnim (Number): number of the animation
- Boolean sprite:isAnimationAtEnd(nbAnim)
Return true if the animation has drawn the last frame
nbAnim (Number): number of the animation