Restart just parts of the layout

Get help using Construct 2

Post » Mon Feb 24, 2014 11:50 am

Hello,
I got a question.
So I'm making a platformer game and I'm stuck at something.
There's a part in the game where the player has to stand on a platform, and while doing that it triggers the platform to go up (using the bullet behaviour), then you need to manouvre around obstacles and such.
If you get hit by an obstacle, you die and respawn at the nearest checkpoint.

Now here's my problem; when the player dies, the platform is still going up, while the player is back at the beginning of the level where the moving platform started (but isn't anymore..), meaning the player can't proceed since the platform isn't there anymore.

The simple solution would be to just restart the layout, but I was hoping there would be another solution since my checkpoint system doesn't work with restarting the layout..

can anyone help me? If anything is not clear I can post pics or cap to show what I mean..
B
12
S
1
Posts: 28
Reputation: 978

Post » Mon Feb 24, 2014 12:32 pm

Restarting the layout seems... kind of harsh too here.
You have some kind of lift, and it doesn't stop going up, here is your problem. You should have it go down after some time. What if the player falls from the lift ? Is he supposed to suicide in order to restart ? It would be strange...
If at some point you detect that the player is on the platform, you could also start to test if the player is still on the platform, or if the platform has reached its top position. When this happens, you could then start to move the platform down again.

If all this doesn't go with your plan, you could also use the "savestate" functionality. At the start of the game (after the layout starts), save your game (System : Save). At the end, just reload this save. Now, add the behavior "nosave" on everything that is supposed to not be reset between the player's try, like the highscore, the number of life, ... And here you go :)
B
17
S
8
G
4
Posts: 473
Reputation: 6,221

Post » Mon Feb 24, 2014 12:33 pm

give the platform 2 instance variables (startx and starty) and when the player dies call a routine that just sets the platform back to these remembered points.
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Mon Feb 24, 2014 12:45 pm

Thanks guys, will try both and pick which one suits better!
B
12
S
1
Posts: 28
Reputation: 978

Post » Mon Feb 24, 2014 12:49 pm

B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Mon Feb 24, 2014 1:36 pm

Thanks! helped alot
B
12
S
1
Posts: 28
Reputation: 978


Return to How do I....?

Who is online

Users browsing this forum: jojomickymack, LogoGuy2017, pegasus6464 and 24 guests