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

2015/5/26

How do i make a randomly spawning enemy?

drummer602 drummer602

2015/5/26

#
I am trying to make an enemy that spawns at random times INSIDE the game and not just when i reset the game. please help!
 if (Greenfoot.getRandomNumber(30)<10){
            addObject(new Mothership(), 90, 5);
        } 
this is what i have so far but that just places the object when i start the game, not spawn it at random times
danpost danpost

2015/5/26

#
The 'act' methods of the active world and all actors in that world are called throughout the game. Place the code in an 'act' method.
drummer602 drummer602

2015/5/27

#
Thanks a ton!
You need to login to post a reply.