Great game! You clearly put in a lot of extra time and effort. Game feels very complete. Fits well into the Survival/Squirrel genre, would be nice if you could fight back though.
I forgot to mention that you get a powerup if you eat 6 cactuses. It wears off after each "level" though.
Did you make it to the boss? I still have to finish the boss level (shuold be like level 5 or 6) but i wanted to upload what i had so far
Great job Matt! Really fun to play.
I looked at your code for squirrel to figure out how you changed speed after eating cherries. I see "speed=0", then after berries eaten "speed +=5" etc. Where is method for speed? I looked in mover, but only saw the usual.
It would be great if you could add some comments to your code to help tyros like myself learn how to write great code like yours!
The following code is what the speed thing boils down to. Speed is basically just an int variable that i use in my "if key is pressed, the move that way" methods. it combines the value of speed (which can be negative or positive, negative lets me "stun" the character by making his total movement zero, but if this goes negative we'll get some wierd results) with the number in the move() method.
Speed is increased when i eat a berry. Speed is decreased once the berry timer runs out. take a look:
private final int BERRIESTIMER = 500;
private boolean berriesEaten = false;
private int speed = 0;
public void act()
{
checkKeysPressed();
lookForBerries();
if (berriesEaten)
{
berriesTimer();
}
}
public void checkKeysPressed()
{
if (Greenfoot.isKeyDown("right"))
{
setRotation(0);
move(5 + speed);
}
// the rest of the keys to follow
}
public void lookForBerries()
{
if (canSee(Berries.class))
{
eat(Berries.class);
speed+= 5;
berriesEaten = true;
myPoints += 200;
Greenfoot.playSound("berries.wav");
}
}
public void berriesTimer()
{
berriesTimeLeft--;
if (berriesTimeLeft == 0)
{
berriesEaten = false;
speed -= 5;
berriesTimeLeft = BERRIESTIMER;
}
}
what i meant was, if move(5 + speed) results in a negative number, we'd get backwards movement which wouldnt make any sense. unless the squirrel was confused. actually, that gives me an idea
2012/3/10
2012/3/10
2012/3/10
2012/3/10
2012/3/10
2012/3/10
2012/4/16
2012/4/16