enemy implementation class suggestions needed

hi

Ive come to the point where I can have enemies that can die when the player jumps on them…they also have animations using my class ImageMultiAnimationSprite.

I need some way to implement different actions…so that the enemies can jump or fire or walk…but Im not sure what classes i could make. Maybe i need to make some ai thing in the Game class so that every “tick” it can go throug all sprites and call their methods. But should the sprite itself decide its action or should the action be set like sprite.setaction(jump)
or maybe the sprite could just decide itself?
im kind of stuck here so if you have an idea il be glad to hear it

http://www.cokeandcode.com/temp.png

Each “tick” of the game, you call act on each of the enemies currently in the game. They do what ever they like (run/jump/fly etc…) and relocate the sprite that represents them. Then draw all the sprites (either via the enemy, or from some global list)

Is this what you were describing above? Just a first thought. The enemy loader is inteded to allow loading enemies (with associated sprite defintions and stats) from some other file. Maybe its part of the level loader?

Kev

thanks for replying

yes, this looks like a good idea and what I was describing.

The level loader can load enemies too. I have made the map editor and loading and already planned enemy loading because its just like the map loader…

btw my game is based on gage.

I dont understand the arrows of your drawing 100%, is JumpingEnemy etc extending the Enemy interface?

Implementing the interface, yep. It should be standard UML notation. (Produced it with Jose - http://www.newdawnsoftware.com/jose ).

GAGE is great for 2D. Myself, I use the GAGE timer everywhere. Wonder when SUN will get round to make it part of the API :wink:

Kev

yes, I hope they make a better api for gaming soon.