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

2013/10/17

Help with movement

Rhino1181 Rhino1181

2013/10/17

#
I dont have the code at the moment but i will have it tomorrow, its for a space invaders game... whenever the invaders touch the edge of the screen they take it in turns moving across and overlap eachother and its just a mess, does anybody know how to make them all move together? like in the proper game, as a block of aliens which all move to the other side when one touches the wall
danpost danpost

2013/10/17

#
If an alien is moving right and encounter the right edge or is moving left and encounter the left edge, then all alien objects needs to be instructed to shift down some and move the other way. Just put what I just stated in code (it would be put in the act method, or a method it calls, of the Alien class).
Rhino1181 Rhino1181

2013/10/17

#
yeah, ive got that working, all of them turn the other way and move down but they dont do it in time, they like, take it in turns, so one will hit and turn, the next will hit the wall and turn and so on and so forth. what im trying to figure out is how to get it to when the alien furthest to the right hits the right wall, all of the aliens turn at the time of the impact. oh, and i have them moving down as well, i just need to get them in time
You need to login to post a reply.