This site requires JavaScript, please enable it in your browser!
Greenfoot back
memara
memara wrote ...

2014/7/8

Help with bringing object back in my world

memara memara

2014/7/8

#
Hey, I have to do a Greenfoot project for school Our game is about a bird who has to catch a fish who comes out of the water But when the bird catches the fish, it removes the fish from the world and stops the game I just want that a new fish appears when the old one is eaten and that the game doesn't stop How does that work?
kinobi kinobi

2014/7/8

#
public void NAME () { if(getWorld().getObjects( NAME .class).size()<1) { NAME newnAME; newNAME = new nAME(); int x = Greenfoot.getRandomNumber(PLACE WHERE THE FISH SHOULD BE ADDED ); int y = Greenfoot.getRandomNumber(PLACE WHERE THE FISH SHOULD BE ADDED ); getWorld().addObject(newNAME, x, y); } }
kinobi kinobi

2014/7/8

#
the first two NAME's have to be written with capital letters in your case that would the Fish i think
kinobi kinobi

2014/7/8

#
the first to Name's where a "new" is in front sorry
You need to login to post a reply.