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

Report as inappropriate.

wagnerf
wagnerf presents ...

2011/6/18

Guns vs Zombies

HOW TO PLAY:

-"WASD" to move the player
-Arrow Keys to move with rotating
-To shoot, space bar, "k" key and clicking with mouse
-To rotate the player, you also can press "j" and "l" keys, or use the mouse

-To change your Weapon, Press:
1 for Pistol
2 for Shotgun
3 for Rifle

Get itens and take care, zombies will kill you!!!!!

Created by Wagner Alves and Vitor Santos

Institute of Mathematics and Statistics
-Universidade de São Paulo-

14036 views / 17 in the last 7 days

18 votes | 0 in the last 7 days

Tags: mouse game simulation demo shoot zombies guns top horror view walking

This scenario is a member of: BCC-IME-USP


Your browser is ignoring the <APPLET> tag.
tylerstylers

2012/8/8

probably setImage(...) method.
gusbus123gusbus123

2012/8/8

you should have a limiter for the amount of zombies so the game doesnt become impossible.
gusbus123gusbus123

2012/8/8

@09blackn from the top of my head im thinking the code would be somewhat like this: [code]private boolean dead; // default is false public void act() { checkDeath(); if(!dead) { //other codes like movement and that. } } private void checkDeath() { if(!dead) { if(getOneIntersectingObject(Bullet.class)) //returns true if the zombie is hit by a bullet. { dead=true; Greenfoot.setImage("Blood.png"); } } }[/code] the checkDeath() could also just be part of the act, not a seperate "void".
gusbus123gusbus123

2012/8/8

@wagnerf have you tried using the "turnTowards()" code? it should be alot simpler.
lemur07lemur07

2012/8/9

On survival, I got a score of 360,330 before I got bored and gave up. I had 730 health when I decided to give up.
wagnerfwagnerf

2012/8/9

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
09blackn09blackn

2012/8/15

How did you stop the actor from traveling through the wall ? Thanks
09blackn09blackn

2012/8/15

How did you stop the actor from traveling through the wall ? Thanks
wagnerfwagnerf

2012/8/15

@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! :)
David123David123

2012/8/17

how did you stop the sound in menu then change to the game sound

See all comments

Want to leave a comment? You must first log in.

Who likes this?

L_Perez14 stogdilli Lildarkone BIG-red-BUTTON Advenging AndrePest St.Jimmy daskjet Dreikäsehoch rafael.gregorut edenis.freindorfer mayaracm VitorGuitar drhorriblejr Duilio giskard raverona ricardo.guimaraes