Hi, I'm writng my first maze game.
I've based my project from the
http://www.cokeandcode.com tutorials (spaceinvaders and tilemaps)
So, I've a Game class, Sprite, SpriteStore, Entity,Enemy,Player and Bonus
Now I want to create an animation (like cartoons) for Entity and bonus objects; I think that a good idea is to create a class like the Animation class from "new riders java game developers" book.
The Animation class will extends the sprite class and contain this methods:
1
| public synchronized void addFrame(Image image,long duration) |
Adds an image to the animation with the specified duration (time to display the image).
1
| public synchronized void start() |
Starts this animation over from the beginning.
1
| public synchronized void update(long elapsedTime) |
Updates this animation's current image (frame), if neccesary.
1
| public synchronized Sprite getImage() |
Gets this Animation's current image. Returns null if this animation has no images.
The sprite class is the original class from Spaceinvaders tutorial
http://www.cokeandcode.com/info/showsrc/showsrc.php?src=../spaceinvaders/org/newdawn/spaceinvaders/Sprite.javaThe constructor of Animation is:
[CODE] public Animation(ArrayList frames, long totalDuration) [/CODE]
so, in the Sprite class I've add an empty constructor
What do you think?? it's a good idea??