Hello y'all, I haven't been active on this site for a while, but I recently took a look through the code for this game and almost vomited... So, I decided that I will remake this game following all the proper programming conventions to make the code as easy and sensible as possible.
small glitch, if you are using a speed-up or a slow-down and you die while doing so, the effects never wear off. If you were using a speed-up and you died, you are permanently faster, so i was playing and i got a speed-up, died, got another, died, and got a third one before dying, and i was permanently three times faster!!! the same thing with the slows
This scenario is kinda messed up... You can go way off the edge, when you reset the scenario it doesn't reset your lives or points, and it still doesn't even if you reload the page!
For lives, you have to have a Counter class of some sort (at least in my experience). In the world class, you do the following:
public MyWorld()
{
public Counter lifeCounter = new Counter("Lives: ");
addObject(lifeCounter, x coordinate, y coordinate);
}
public Counter getLifeCounter()
{
return lifeCounter;
}
Now, with other classes you can use getLifeCounter to add and subtract. In the Counter class that I use, there is an add(int score) method, so if I was adding a life, I could do
((MyWorld)getWorld()).getLifeCounter().add(1);
and that would add one. Also, if I lose a life, I would do
((MyWorld)getWorld()).getLifeCounter().add(-1);
You can do this now from any other Actor you like. The key is the Counter class though.
2015/8/9
Dodge
2012/1/12
crab
2012/1/12
crab
2012/1/9
Dodge
2012/1/8
Chicken Invaders 2.0
2012/1/8
Dodge
2012/1/8
Dodge
2011/12/21
Frogger
2011/12/19
Dodge