Game over when actor touches edge of screen

Hi everyone, I wanted to know, how I would end the game, when my actor(a snake) touches the edge of the screen.
So when my actor(a snake) touches the edge of the screen, I want it to say game over, display the score, a retry button and also go back to main menu button.

Please can you explain in as much detail as possible, thank you.

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    There are a few ways you could handle that.

    1. Surround your screen edges with an actor that when touched will trigger the end game events. This actor should be placed on the pasteboard beyond the edge of the screen so the player can't see it.

    2. Keep track of the players X and Y locations and use these to trigger the end game events when they go beyond the edges of the screen.

  • TheTigerTheTiger Member Posts: 53

    @jamie_c said:
    There are a few ways you could handle that.

    1. Surround your screen edges with an actor that when touched will trigger the end game events. This actor should be placed on the pasteboard beyond the edge of the screen so the player can't see it.

    2. Keep track of the players X and Y locations and use these to trigger the end game events when they go beyond the edges of the screen.

    Thanks for that Jamie_c.

    I want to have the game over, score, retry and back to main menu on the same screen as where you play the game, so I want the game in the backround, so would I have to create another scene? How would I do it?

    Thanks.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
Sign In or Register to comment.