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

2020/6/11

is there any way i can make a command to press a button and restart the world?

lilshopa lilshopa

2020/6/11

#
i would like to know if i can do that by putting a button to restart if you die (only showing the message "gameover, press x to restart" or i have to create another subclass with a gameover screen
danpost danpost

2020/6/11

#
lilshopa wrote...
i would like to know if i can do that by putting a button to restart if you die (only showing the message "gameover, press x to restart" or i have to create another subclass with a gameover screen
Well ... creating a new subclass of World for a game over screen would be the easiest. You would have less possible complications that way. That does not mean you cannot just add an actor or two to your game world and have it work straight away (that is, adding a game over message and a restart button). I really depends on how well you have coded your game.
lilshopa lilshopa

2020/6/11

#
well i guess i will go with the easiest way xD
lilshopa lilshopa

2020/6/11

#
ok so, when my enemy hits the main character it will take him to the "FimdeJogo" screen(gameover screen)
Actor buzz;
        buzz = getOneIntersectingObject(buzz.class);
        if(buzz!= null)
        {
            World Mundo1;
            Mundo1 = getWorld();
            Mundo1.removeObject(buzz);
        }  
the code look like this but how do i put it so it can go to there?
danpost danpost

2020/6/11

#
lilshopa wrote...
ok so, when my enemy hits the main character it will take him to the "FimdeJogo" screen(gameover screen) << Code Omitted >> the code look like this but how do i put it so it can go to there?
Create a FimdeJogo world and then use the Greenfoot class setWorld method to activate it.
lilshopa lilshopa

2020/6/11

#
did it! thank you
You need to login to post a reply.