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

2019/6/8

Spawn another Actor if a certain Actor is removed

loldertroll loldertroll

2019/6/8

#
So I am making a scenario right now with bosses. If a boss dies I want a door to spawn, but I dont know how.(there are 3 bosses in one room)
danpost danpost

2019/6/8

#
loldertroll wrote...
So I am making a scenario right now with bosses. If a boss dies I want a door to spawn, but I dont know how.(there are 3 bosses in one room)
One of the following two ways to start should work: This:
if (getObjects(Door.class).isEmpty() && getObjects(Boss.class).size < 3)
or this:
if (getObjects(Door.class).isEmpty() && (getObjects(Boss.class).isEmpty() || getObjects(Boss2.class).isEmpty() || getObjects(Boss3.class).isEmpty()))
loldertroll loldertroll

2019/6/8

#
.size is not working
Super_Hippo Super_Hippo

2019/6/8

#
Use "size()" instead.
loldertroll loldertroll

2019/6/9

#
Super_Hippo wrote...
Use "size()" instead.
thats not working for me either
loldertroll loldertroll

2019/6/9

#
public MyWorld()
    {  
       
        super(1024, 550, 1,false);
        
        addObject(new Spinne(), 800,300);
        addObject(new Spinne(), 800,225);
        addObject(new Spinne(), 800,100);
        addObject(new Jim(),200,225);
        
        
       
            
    
}
this is the code , it might help. (Spinne is the boss and jim is the player)
danpost danpost

2019/6/9

#
loldertroll wrote...
<< Code Omitted >> this is the code , it might help. (Spinne is the boss and jim is the player)
You are probably not putting the attempted codes in the right place. Try within an act method.
You need to login to post a reply.