Well, I'm trying to do decent thing to have an engine that handle some objects as sprites, that can come with various frames and positions. I've the idea to have a RAM buffer, where all parameters such as X/Y positions would be stored for every sprites, along with an "enable" flag that would simply tells if the sprites does exist or not, and if it exist the non-zero number in it tells wich kind of monster/projectile the sprite is, along with some others variables that would be customizable in function of the sprite type itself.
Now, the problem is when I want to draw them to the screen. They have to come in various sizes, and all of them would surely have different frames/positions, so that would need to write different data to the tile index and the flipping registers. I simply have no idea of how to pass from just knowing the number of the sprite ID and the number of it's frame to actual data to write to the sprite buffer. The only idea I had is to make a jump table that would jump to different code for each possible sprite object, that can be a monster or a projectile, but, heh I don't know if this is good at all.
Also, there should be some more flexibility in it, so a sprite ID as a monster could also show an "explositon" instead, if the monster is just defeated or something.
Any ideas ?
Now, the problem is when I want to draw them to the screen. They have to come in various sizes, and all of them would surely have different frames/positions, so that would need to write different data to the tile index and the flipping registers. I simply have no idea of how to pass from just knowing the number of the sprite ID and the number of it's frame to actual data to write to the sprite buffer. The only idea I had is to make a jump table that would jump to different code for each possible sprite object, that can be a monster or a projectile, but, heh I don't know if this is good at all.
Also, there should be some more flexibility in it, so a sprite ID as a monster could also show an "explositon" instead, if the monster is just defeated or something.
Any ideas ?