How do I make game to continue without checkpoint

0 favourites
  • 7 posts
From the Asset Store
In this template the music plays without looping in your game
  • Hello

    Thank you for checking my post. I have an endless running game and I want the user to be able to continue one time the game if he dies. So basically I have a popup that shows once the player dies first time. If he wants he can use coins and continue the game. What I want is to be able to re-spawn the player in a safer place and give him the opportunity to continue running. I don't want to use checkpoint because this is a endless game and objects (ground, enemies, etc) appear randomly. So it will be hard to place a checkpoint in the game.

    Does anybody have a way to put all these together?

    Thank you

  • The first idea that came to mind is to have a checkpoint trailing behind the player location. When you use the checkpoint to respawn, disable enemy spawnng for x amount of time, and place x amount of flat ground before starting up your procedural generation again.

  • Hello oosyrag

    Thank you for your reply.

    I am not sure to understand your solution.

    What I am trying to do now is:

    • every X seconds create a checkpointobject on ground at checkpoint image.
    • everytime the player overlap with that object, the game is saved (slot:"mysave")
    • when user hit continue button after die, the game is load to the previous checkpoint touched by player.

    That works but currently there are 2 problems

    • first, I want the user to be able to continue only onetime. meaning that when he dies first time and continue, the second time he does not have the option to continue again. Currently the continue windows appears everytime the player dies.
    • also when the game is saved, when you close the game and come back, that save is still there. let say player starts a new game and does not overlap with any checkpointobject and dies, when hit continue, he is respawn to the previous saved game ( don't know if there is a way to delete the save after player dies second time or when game goes to game over page, the save slot is cleaned; like that if you restart a new game the slot will be empty)

    Thanks again

    Regards

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This is a complex problem and should be broken down into multiple smaller problems :

    First: how to know that the player has passed a checkpoint.

    Checking for overlap is a bad idea. If the player jumps or misses the checkpoint then it won't work.

    A better solution is to compare the X coordinate of the checkpoint to the X coordinate of the player. I suppose you're making a side-scroller (otherwise, you can switch X with Y). So the player will pass when her X is greater than the checkpoint's X. Maybe throw in a flag to mark the checkpoint as passed.

    Next :

    "first, I want the user to be able to continue only onetime. meaning that when he dies first time and continue, the second time he does not have the option to continue again. Currently the continue windows appears everytime the player dies."

    Have a global variable named "DeathCount" (initialized to zero), increment it whenever the player dies. Before you increment it, check if its value is equal to 1, if yes then show your game over window, if not, then just respawn the player.

    Next mini-problem: Saving the progress

    Well from a game design perspective. I'd say don't even bother. No one is going to bother saving their progress in an endless runner, especially if it's for mobile or browser.

    Let's say you want that anyway, your solution works. The system's "save/load" functions will do the job just fine.

    Next mini-problem: The death save

    Use the WebStorage plugin to save a simple flag, let's call it "SaveIsValid", set it to 0 when the save slot is a death slot, and set it to 1 when it's ok for the player to continue the game.

  • Hello Zed2100

    Thank you very much for your detailed instructions.

    Actually I tried to modify and I messed everything up. I will try to start over this week end and see.

    To save the game actually I did not want to use the save/load function. I first started to see if I can do something like

    • on Player.X >= checkpointobject ==> set global variable checkpoint_x = Player.X and checkpoint_y = checkpointobject.Y
    • on touch continuebtn ==> set Player position = checkpoint_x and checkpoint_y

    But that did not work

    Do you have a simple way to respawn the player and then keep everything same (meaning that distance run will continue to increment , coins also, etc)

    Thank you

  • Hello Zed2100

    Thank you very much for your detailed instructions.

    Actually I tried to modify and I messed everything up. I will try to start over this week end and see.

    To save the game actually I did not want to use the save/load function. I first started to see if I can do something like

    - on Player.X >= checkpointobject ==> set global variable checkpoint_x = Player.X and checkpoint_y = checkpointobject.Y

    - on touch continuebtn ==> set Player position = checkpoint_x and checkpoint_y

    But that did not work

    Do you have a simple way to respawn the player and then keep everything same (meaning that distance run will continue to increment , coins also, etc)

    Thank you

    You're asking me to explain the specifics of your game to you, well I cannot do that because only you know the specifics. I'll ask you again to break down the problem into smaller manageable chunks.

    First, it seems that you don't know how WebStorage works. If I were you, I'll read tutorials on that and implement some examples first until I understand it completely.

    Then, you can do what I suggested in the previous post.

    I believe this is the best way to learn and improve. When you re-implement your code, tag me Zed2100 and tell me how it went.

    Good luck!

  • Hello Zed2100

    Thank you very much for your advices.

    I will look into webstorage again to see

    Regards

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)