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

Comments for Zombie Rescue Squad

Return to Zombie Rescue Squad

A new version of this scenario was uploaded on Thu Oct 10 23:17:05 UTC 2013 Fixing the speed problem.
askgriffaskgriff

2013/10/10

I'd like to figure out how to stop the original looping sound when the game is over (i.e. the player gets bitten) and then display a new graphic (a "game over" thing) but I am still learning.
You can stop the sound with the stop() method for GreenfootSound. There are two plays, one is play(), and the other is playLoop(). playLoop() will play the sound in loops. play should only play it once.
danpostdanpost

2013/10/11

In addition to what FRUP said, the sound needs to be set in a GreenfootSound object reference field: [code]GreenfootSound bgSound = new GreenfootSound(/* name of sound file */);[/code] so it can be referenced later, in order to use the 'stop' method: [code]bgSound.stop();[/code]
danpostdanpost

2013/10/11

BTW, you must start the sound using this reference also or it will not stop using the reference bgSound.playLoop();
A new version of this scenario was uploaded on Thu Oct 17 16:46:52 UTC 2013 Made new zombies appear where they were turned, added additional sound effects, and fixed a couple bugs.
A new version of this scenario was uploaded on Thu Oct 17 19:48:59 UTC 2013 Adjusted the music to prepare for stopping background sounds.
askgriffaskgriff

2013/10/17

Danpost (and FlyingRabigUnicornPig) - I moved my background sound over to my "Monster" class since it's the thing that ends the game. I started with: "private GreenfootSound bgSound = new GreenfootSound("music.mp3");" and then in the "tryToEatPlayer" class I added "bgSound.stop();" when he's eaten. It doesn't stop the sound, however. I know it's something dumb -- I just don't see it.
danpostdanpost

2013/10/17

I suggest moving it back to your World sub-class and making it a 'static' field. Then in your Monster class you can use: 'WorldClassName.bgSound.stop();'.
danpostdanpost

2013/10/17

You can also, then, start it in the 'started' method in the world. There are probably information tags in your sound file(s) that need to be removed so they do not throw ArrayOutOfBoundsException errors when the sound file has completed a loop.
kimber_jokimber_jo

2013/10/18

This is difficult:/ I got 255.
kimber_jokimber_jo

2013/10/18

But it's awesome!
askgriffaskgriff

2013/10/18

Wow -- every step I learn something new I realize to make it work I need to learn two NEW things. LOL
A new version of this scenario was uploaded on Fri Oct 18 16:34:41 UTC 2013 Moved sound back to MyWorld. Added an Environment Superclass. Fine tuning code.
askgriffaskgriff

2013/10/18

I moved the sound back to the MyWorld class where it really should be. I just need to figure out how to access it from other classes. I don't get the "static" setup yet but I will. Other things I want to begin adding include: · Game Over graphic · Have zombies chase player and bonuses if they are within range · Have Bonuses run from zombies and toward player if they are in range · Implement "lives" · Make "walls" un-passable (act like walls) · Have the "map" change from level to level
A new version of this scenario was uploaded on Sat Oct 19 00:54:35 UTC 2013 Got the "Game Over" screen working (Thanks Jacob!), the music stops at the end now, and I built custom sprites for the main player (still some fine tuning to do there). Also completely changed the movement method to work with the new sprites.
A new version of this scenario was uploaded on Sun Oct 20 17:31:52 UTC 2013 Fixed a couple glitches and remembering to publish the source code this time.
askgriffaskgriff

2013/10/20

What is the most "elegant" way of making the wall blocks unpassable? I thought about doing the "ifCanEat" method to avoid moving -- but I don't know if that's the best way.
MatheMagicianMatheMagician

2013/10/21

I would suggest using the "getIntersectingObjects(Wall.class).size()>0": this checks whether there are any walls touching the character. You can then back up if it is touching. If you want, I can give you some example code (you probably want to try yourself first, though).
A new version of this scenario was uploaded on Wed Oct 23 06:32:30 UTC 2013 Adding a new "Wall interaction" using getIntersectingObjects. Having some difficulty getting the player to just not be able to go through walls. He tends to get "stuck" and move in the opposite direction at times. Suggestions?
A new version of this scenario was uploaded on Wed Oct 23 15:13:32 UTC 2013 Adding a new "Wall interaction" using getIntersectingObjects. Having some difficulty getting the player to just not be able to go through walls. He tends to get "stuck" and move in the opposite direction at times. Suggestions?
askgriffaskgriff

2013/10/23

My code with intersectingObjects was overwritten by my old code. Back to the drawing board. :/ I'll take this opportunity to comment and organize my code before I re-implement it.
A new version of this scenario was uploaded on Wed Oct 23 16:29:20 UTC 2013 FINALLY got the walls working properly. It was a mental roadblock for me and I discovered what was broken. Sorry for yet another update. I'm getting there!
A new version of this scenario was uploaded on Wed Oct 23 17:07:12 UTC 2013 Walls are working for zombies and bonus (survivors) now. Cleaned up more code.
A new version of this scenario was uploaded on Thu Oct 24 16:35:38 UTC 2013 Changed the "CanSee" and "Intersecting Object" code to "isTouching". It seems to work pretty well. Thoughts?