@09blackn
What I did it's not the best thing, but it was:
I call the method setPosition of the Actors if: the booleans are like: trying to move up and wallTop == false, trying to move down and wallBottom == false, trying to move left and wallLeft == false, trying to move right and wallRight== false.
To set this booleans, i used the method getOneObjectAtOffset(actor.getX() + dx, actor.getY() + dy, Wall.class), where dx and dy depend on the position of the wall you want to compare.
That's the idea of how I did when I made this game! :)
hey @gusbus123, thanks for your comments xD
For the blood, i created a class named "ZombieBlood" that just puts an image in the position that the zombie died. I create 150 objects of blood every level. When i don't have 150 bloods yet, i create; when i do have, i only call setPosition of the first ones. At the moment the bullet hits the zombie, both are removed.
When i made this game, i had a version before "Greenfoot 2.1.0 (8. June 2011)", so the turn methods in Actor weren't built yet. (http://www.greenfoot.org/version_history). That's why i didn't use the turnTowards().
This were a one month project of Computer Science 101. Also, i didn't know anything about programming before. Sorry if my English is not great, and I hope you understand I was "a pretty bad programmer", because I was just learning at that time :D
Thank you all for the feedback!
[]'s
Recent Comments | Show All
2012/8/15
Guns vs Zombies
2012/8/9
Guns vs Zombies