i'm going to change it so that the particle accepts a parameter of shapeSize so that it's size is determined upon creation, not while it's moving, cause they all change when i click. not sure if that's what we want here
i'm at a real loss about joining the dots. i thought about changing it from fillOval to drawLine. i also think that the particles have to be able to communicate with eachother somehow.
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
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;
}
}
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
2012/3/11
Snake
2012/3/11
Mouse Drawing Colors v3
2012/3/11
Man Eating HAMBURGER
2012/3/10
Odysseus
2012/3/10
Squirrel Quest
2012/3/10
Squirrel Quest
2012/3/10
Squirrel Quest
2012/3/10
Super Raver Z
2012/3/10
Squirrel Quest