How do I make game to continue without checkpoint

Get help using Construct 2

Post » Mon Apr 23, 2018 4:25 pm

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
B
16
S
4
Posts: 34
Reputation: 1,016

Post » Mon Apr 23, 2018 5:40 pm

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.
Mistakes were made.
B
61
S
30
G
134
Posts: 1,970
Reputation: 75,442

Post » Wed Apr 25, 2018 4:38 pm

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
B
16
S
4
Posts: 34
Reputation: 1,016

Post » Wed Apr 25, 2018 10:30 pm

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.
Professional Construct and Unity developer, experienced artist and game designer.

"The world wants you to be average, be different, seek difficulty and challenge in everything, be a winner."

Visit my store to make your game look and feel awesome.
B
46
S
15
G
10
Posts: 211
Reputation: 8,029

Post » Fri Apr 27, 2018 4:12 pm

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
B
16
S
4
Posts: 34
Reputation: 1,016

Post » Fri Apr 27, 2018 5:32 pm

marc254 wrote: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!
Professional Construct and Unity developer, experienced artist and game designer.

"The world wants you to be average, be different, seek difficulty and challenge in everything, be a winner."

Visit my store to make your game look and feel awesome.
B
46
S
15
G
10
Posts: 211
Reputation: 8,029

Post » Mon Apr 30, 2018 11:37 am

Hello @Zed2100

Thank you very much for your advices.
I will look into webstorage again to see

Regards
B
16
S
4
Posts: 34
Reputation: 1,016


Return to How do I....?

Who is online

Users browsing this forum: visionarybeast and 8 guests