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

What is happening right now?

YunitaPutri

reply to Pause and resume

By YunitaPutri - 10 minutes ago
Like this public void pauseAndResume(){ if (Greenfoot.isKeyDown("space")) { while (!Greenfoot.isKeyDown("enter")) { Greenfoot.delay(1); } } } }
Super_Hippo

reply to Does Greenfoot.mouseClicked() only work if the parameter is the object itself (this)?

By Super_Hippo - 21 minutes ago
Add them in the second constructor. Everything which should be added to every world has to be outside of the switch. If you want to have something in only world x, add it like the CafeteriaDoor object in a switch case. If you need to have the SAME inventory object in every world, you have to pass it like the UserWalk1 object. The more objects you want to have like that, the more useful it will be to either pass the whole world and get the references to the objects or (-as suggested in the first post on this page-) make the references static, so they are shared with all MyWorld instances.
joshuadswa

reply to Shooting Range

By joshuadswa - 31 minutes ago
OK thx all :D
Super_Hippo

reply to Many errors that need fixing.

By Super_Hippo - about 4 hours ago
2. Everything. The Asteroid's act method is executed for every Asteroid object in the world. If no Asteroid is in the world, no new Asteroid will be spawned. If you have for example 10 Asteroids in the world, each one tries to add a new one. Instead, you always want one Asteroid to be spawned every 0-177 act cycles. You also messed something up with the speed of the Asteroids. I would suggest you can use this: <Code Omitted> Adding the asteroid to the world (from MyWorld) <Code Omitted> Last but not least, the Boop: <Code Omitted> And when adding the Boop: (related to Error 3) <Code Omitted>