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

2023/12/1

Help!!!!

Mikemogna Mikemogna

2023/12/1

#
I am Having problems getting my Greenfoot to show game won once all the worms are gone I have the world stopping but I can't get show text to work. public class Crab extends Actor { /** * Act - do whatever the Crab wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { move (4); if (Greenfoot.isKeyDown("left")) { turn(-3); } if (Greenfoot.isKeyDown("right")) { turn(3); } Actor worm; worm = getOneObjectAtOffset(0, 0, Worm.class); if (worm != null) { World world; world = getWorld(); world.removeObject(worm); } if(getWorld().getObjects(Worm.class).isEmpty()) { Greenfoot.stop(); } } }
danpost danpost

2023/12/2

#
Mikemogna wrote...
I am Having problems getting my Greenfoot to show game won once all the worms are gone I have the world stopping but I can't get show text to work. << Code Omitted >>
The last if block should probably be in the act method of your World subclass (with the showText line).
You need to login to post a reply.