How to store character moves (sprite animations)?
Posted
by
Saad
on Game Development
See other posts from Game Development
or by Saad
Published on 2011-05-16T06:36:09Z
Indexed on
2011/06/23
8:30 UTC
Read the original article
Hit count: 357
So I'm thinking about making a small rpg, mainly to test out different design patterns I've been learning about. But the one question that I'm not too sure on how to approach is how to store an array of character moves in the best way possible.
So let's say I have arrays of different sprites.
This is how I'm thinking about implementing it:
array attack = new array (10);
array attack2 = new array(5);
(loop)
//blit some image
attack.push(imageInstance);
(end loop)
Now every time I want the animation I call on attack or attack2; is there a better structure? The problem with this is let's say there are 100 different attacks, and a player can have up to 10 attacks equipped. So how do I tell which attack the user has; should I use a hash map?
© Game Development or respective owner