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

2012/5/18

Reset atWorldEdge

needcodehelp needcodehelp

2012/5/18

#
Can you post some code examples to show how to "reset" a game once an item "falls off" the world edge? It's a breakout type game and when the ball falls off the bottom edge, we want to have the game reset so a new ball appears to start play again. Assume we need to do something with atWorldEdge...? THANKS!
SPower SPower

2012/5/18

#
When you detected you 'fall off' an edge, you need to reset the world doing this:
Greenfoot.setWorld(new MyWorld());
Replace 'MyWorld' by your own subclass of World.
You need to login to post a reply.