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

2019/4/17

Having problem with a code - removeObject does not work!

NikhilLimaye10 NikhilLimaye10

2019/4/17

#
enemiesRemaining--;
                MyWorld w = (MyWorld)getWorld();
                Actor respawn = new EnemyRespawn();
                Enemy e = w.getEnemy();
                e.setHealth(100);
                w.addObject(e ,280 ,540 );
                w.addObject(respawn ,280 ,540 ); 
                w.removeObject(respawn);
NikhilLimaye10 NikhilLimaye10

2019/4/17

#
Can anyone help with any mistakes I may have made! Would be great help. Thanks! :)
Super_Hippo Super_Hippo

2019/4/17

#
What are you trying to do? You create a new EnemyRespawn object, you add it to the world only to remove it again instantly.
You need to login to post a reply.