Great suggestions, here's the deal:
- Any source code for a rock counter is great, I don't know how
- The fact that the rocks don't spawn exactly at the top is intended, just the way I made the code makes this necessary
- Health is a little bit beyond me at this point. I'm not that experienced and not enough people put up their source code :(
ANY recommendations always welcome though :P
I've never done counters, but I'm sure it can't be too hard, I'll try it out some time.
Health would be easy (once again, a health counter I don't know). Just add a variable:
int healthLevel = 10;
then under the function for where the guy gets hit with a rock:
rockHit()
{
getNeighborblehbleh...(player)
if
{
blah blah rock hit him
healthLevel = (healthLevel - 1)
if (healthLevel < 1)
{
game over blah...
{
}
}
A new version of this scenario was uploaded on Mon Nov 14 21:45:20 UTC 2011
- Tweaked spawning for rocks
- Made a dead guy picture for when you lose :P
A new version of this scenario was uploaded on Thu Nov 17 02:25:53 UTC 2011
Changed despawn time for Rocks, makes it look cooler.
A new version of this scenario was uploaded on Thu Nov 17 02:44:45 UTC 2011
Added simple falling physics to the rocks, so their speed increases as they fall.
A new version of this scenario was uploaded on Thu Nov 17 22:04:52 UTC 2011
Game came up with an error message when the page loaded, trying to republish to fix.
@Mr.Sandbox
I made a version of this with vertical motion, but I published it as a different scenario called 'Dodge Flier'. In that game, you also have three lives.
A new version of this scenario was uploaded on Fri Nov 25 20:25:05 UTC 2011
Made Rocks a little faster.
A new version of this scenario was uploaded on Fri Nov 25 21:59:25 UTC 2011
- Changed the Character's look
- Added a speed-boost
A new version of this scenario was uploaded on Sat Nov 26 20:01:31 UTC 2011
Added back the rocks that i accidentally deleted :P
Nice job! Could you complete the Acquarium one. I wouldd really like to see what I'm doing wrong. I have all the code done, but my fish don't move like I want them too!
@rjl8789
I published the simulation with the source, at the webpage
http://www.greenfoot.org/scenarios/3855
I left comments in some classes explaining how it works. The classes that I did not put comments in were the Animal class second and third fish classes. The Animal class was not my creation, so try to understand that as best as you can. The first fish has comments, and you can understand the other fish with those.
Soon I'm going to be updating this scenario again with a scoreboard! Only problem is that I'm not 100% sure where on the screen I can put it... any suggestions?
Maybe just make a new World class for the scoreboard?
A new version of this scenario was uploaded on Wed Dec 07 00:57:59 UTC 2011
- Have lightning instead of rocks
- Changed background picture
- Made person get electrocuted when he dies
A new version of this scenario was uploaded on Wed Dec 07 00:59:31 UTC 2011
Changed screenshot
@cooldude
hehe you know, I basically had to become a pro at my own game so that I could test it properly, so that seems kinda funny to me :P
A new version of this scenario was uploaded on Fri Dec 16 02:38:35 UTC 2011
Added the "Red Zone" for the players who think they are too good for the game :P
Right now, I think I hold the record with:
1187 points
A new version of this scenario was uploaded on Fri Dec 16 03:10:25 UTC 2011
Made The Red Zone a little harder-sorry :P
A new version of this scenario was uploaded on Fri Dec 16 23:02:36 UTC 2011
- Changed the speed that the lightning falls at
- Got rid of The Red Zone in favor of gradual build-up of difficulty
- Added jumping with 'up' arrow key, speed burst now 'down' arrow key
A new version of this scenario was uploaded on Sun Dec 18 19:18:50 UTC 2011
- Changed jumping height
- Added a flipping animation
Correction: high score 1100
If you want to see a video of me doing this, go to: http://www.youtube.com/watch?v=8CBrb49--zI
A new version of this scenario was uploaded on Mon Dec 19 20:28:29 UTC 2011
Added slow-motion power-ups (collect then use with spacebar)
A new version of this scenario was uploaded on Wed Dec 21 22:00:54 UTC 2011
Changed speed burst, you no longer slow down but have a constant speed for a short burst
A new version of this scenario was uploaded on Thu Dec 22 15:09:24 UTC 2011
Added lives, you have three lives. When you lose a life 200 points and all power-ups lost. Life counter at top
A new version of this scenario was uploaded on Sat Dec 24 00:19:30 UTC 2011
Changed score losses when you die to 10% of your score
A new version of this scenario was uploaded on Sat Dec 31 23:27:14 UTC 2011
Added 1ups
A new version of this scenario was uploaded on Sun Jan 01 19:26:02 UTC 2012
Game now continues at a slower speed when you lose instead of stopping
A new version of this scenario was uploaded on Sun Jan 01 22:40:35 UTC 2012
- Made score counter more efficient
- Added a no-edge function, toggleable
- Fixed negative slow-motions glitch
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.
To see me make my current record score of 3482 points, go to:
http://www.youtube.com/watch?v=iysfpl0kEaw
A new version of this scenario was uploaded on Thu Feb 02 04:58:09 UTC 2012
- Changed speed boost to ninja roll thing
- Changed Lightning fall speed equation
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.
A new version of this scenario was uploaded on 2015-11-20 06:55:36 UTC
- Changed the sprite for the lightning to something much more appealing
- SlowMotion power-ups no longer spawn while you are already in slow motion
2011/11/10
2011/11/10
2011/11/10
2011/11/10
2011/11/18
2011/11/28
2011/11/29
2011/12/6
2011/12/6
2011/12/7
2011/12/16
2011/12/16
2011/12/16
2011/12/18
2011/12/19
2011/12/19
2011/12/25
2012/1/8
2012/1/8
2012/1/9
2015/8/9