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

2019/4/24

how do I put game completed screen after my car eat all the coins in circular track

hd3377 hd3377

2019/4/24

#
I have made game where my car eats coins in a track.I have put 10 coins in a track and after my car eat all the coins it have to say game completed.I know how to keep game completed screen but I dont know how to put after eating all the coins
Super_Hippo Super_Hippo

2019/4/24

#
After eating a coin, ask the world if any other coin is left in the world. If not, end the game:
Actor coin = getOneIntersectingObject(Coin.class);
if (coin != null)
{
    getWorld().removeObject(coin);
    if (getWorld().getObjects(Coin.class).isEmpty())
    {
        //end game
    }
}
hd3377 hd3377

2019/4/25

#
Super_Hippo it is not working.The car is not eating coin from this code.Please help
hd3377 hd3377

2019/4/25

#
Super_Hippo it worked finally.Thanks a lot.
You need to login to post a reply.