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

benchab

Jonathan Dayton High School, Springfield, NJ

benchab's scenarios

play Clam Catch!

benchab's collections

This user has no collections

Recent Comments

benchab

2012/6/8

Thanks! For the clams I basically made it so that greenfoot generates a random number then if that number is less than 5, create a new clam and have it drop from a random x location. This is the exact code: if(Greenfoot.getRandomNumber(100)<5) { Clam clam = new Clam(); addObject(clam, Greenfoot.getRandomNumber(600), 0); } That's what gives it that small delay because greenfoot is generating random numbers until it hits one below 5, and it also makes it so that there's a random amount of clams being generated each time you play the game. As for the fish, I created one object of each fish and made it so that when that object reaches the end of the screen, it reappears at the opposite end of the screen in a random y location. It makes it seem like there are a ton of fish coming and going but in reality they're the same fish objects appearing at random locations once they've crossed the screen. I'll post the full source code later once I've got it cleaned up a bit.