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

2011/7/31

Shake the the whole world?

nooby123 nooby123

2011/7/31

#
I'm trying to make a space invaders game when every time the player shoots, the world shakes a bit. Is it possible to do that?
mjrb4 mjrb4

2011/7/31

#
Well, there's no built in shake() method or anything of the sort, but it shouldn't be too hard to accomplish! My suggestion would be to store the initial positions of all the actors, generate two random numbers in a small-ish range and then shift the actors by the random numbers given (using one for x and the second for y.) Once you've done this a few times (depending on how long you want the world to shake for) you can just restore the actors to their original positions.
You need to login to post a reply.