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

2015/2/13

Help with adding actors to the world after removing them

SB2612 SB2612

2015/2/13

#
Hi, I'm trying to create something like whack a mole, where the actor controlled by the user moves around the world and eats another actor, but after a few seconds the NPC spawns again in a different location. I'm having the most trouble with adding the NPC to the world again after it's been eaten, as I can't quite figure out how to get the program to check to see if the actor is still there or not. Any suggestions would be greatly appreciated, thanks in advance! -SB2612
danpost danpost

2015/2/13

#
The World class has a 'getObjects' method that returns a List object. If the List object is empty, then no instances of the Class provided were in the world.
You need to login to post a reply.