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

2014/11/30

How to spawn an item when a world is loaded up

DesignerOrb362 DesignerOrb362

2014/11/30

#
I created a racing game with a start menu, but I did this by using the SetWorld method, and every time a world is loaded its blank, I want the ability to spawn actors when a world is loaded (i.e. vehicles on a track or a "back to main menu" button in the options menu), how can this be done, without having to do anything, so the actors load up with the world, any help? I googled and either it didn't work of it didn't exist. Im using v2.4.0 of greenfoot.
Super_Hippo Super_Hippo

2014/11/30

#
Write 'addObject(new ActorName(/* parameters if necessary */), x, y)' and replace x and y with the coordinates. Greenfoot also supports a save world feature to make every actor which you spawned manually will spawn automatically on the same position next time. To do this, right-click on the world background and click the last red line "Save the World". Instead of googling, you can read through the tutorials on this site, they will help you understand how the basics are working. Tutorial Part 1
You need to login to post a reply.