This site requires JavaScript, please enable it in your browser!
Greenfoot back
Svek
Svek wrote ...

2014/5/19

Killing an enemy with multiple hits

Svek Svek

2014/5/19

#
Hello guys, my name is Svek and i have a BIG problem.!! I'm making an Space invaders game, and i got multiple enemies in different sizes. The bigger ones need to die, if its shot by the bullet three times. the smaller ones if they are shot once. Please can someone help me and give me an usable code. Thankss!!
danpost danpost

2014/5/19

#
The most efficient code would depend on your class structure (whether or not you have separate classes for the enemies and what your enemy class(es) extend -- as well as what else you have that extends that superclass).
lordhershey lordhershey

2014/5/19

#
I would just put a member in each alien type, have the hit take one away, when it is less than 1 then do the removeObject call on the alien.
You need to login to post a reply.