[RESOLVED] Restart level & keep chckpt attribute

Get help using Construct 2

Post » Tue Jun 19, 2012 2:46 am

Hi,community me again.

DESCRIPTION
In my game, the player can influence the size of platforms.There is no death, but ther are a multiple checkpoints system in the level. If the player goes outside of the layout, the player is respawned to the last activated checkpoint (on collision).

Then the level is restarted, all the platforms are resetted to their original value.






PROBLEM
- When the level is restarted, the player isn't respawned to last checkpoint because when restarted, this is the always the 1st checkpoint which is considered.
currCheckPoint

WHAT I NEED
- Restart the level when the player is outside layout but keep intact the last checkpoint.
- For now, I'm using a global "currCheckPoint" set to 1 at start of layout



So, how to do that?DirtyArts2012-07-02 04:48:31
Create HTML5 games
B
9
S
1
Posts: 29
Reputation: 1,323

Post » Tue Jun 19, 2012 4:08 am

I've you try to create a first menu layout where to define your global variable currCheckpoint instead of doing that in the level layout ? seems that now restarting a level reinitialize the variable to currCheckpoint=1 if i understand your problem ... so perhaps declare this variable in a menu layout launch only when starting the game and not everytime you start your level solve the problem.

It's just a idea ...which seems have sense ;-pnaelian2012-06-19 04:29:06
B
16
S
5
G
3
Posts: 298
Reputation: 5,240

Post » Tue Jun 19, 2012 4:49 am

You are making one simple mistake don't restart layout.

Go To - Layout - Level 1

wen layout load all previous variables will be the same unless manually all changed by YOU.


Also it looks like in your screenshots, you're not using groups you should really have all engine/programming functions in designated groups. Its just easier for too many reasons to list.


Go To example by N7Effect, on Flickr

you can just replace wen click with outside layer.Erndog2k2012-06-19 05:06:49
B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Tue Jun 19, 2012 5:24 am


Maybe it will help you with the file :)

https://dl.dropbox.com/u/26046730/YH_checkpoinprob.capx

I've try both solutions, but it haven't work :(

Create HTML5 games
B
9
S
1
Posts: 29
Reputation: 1,323

Post » Tue Jun 19, 2012 12:53 pm

You have to set the player's position at the start of the layout. You're setting it before the layout restarts.
(ha 57MB... I was thinking "why is this taking so long to upload?")
Here's a screenshot anyway:
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Tue Jun 19, 2012 4:17 pm

THANK YOU :) it works.

Sorry for the file size :S, I've haven't notice that it was 57 MB!. I'll pay attention to it next time.DirtyArts2012-07-02 04:47:28
Create HTML5 games
B
9
S
1
Posts: 29
Reputation: 1,323


Return to How do I....?

Who is online

Users browsing this forum: Megavolt, mnashwan, stylie1 and 19 guests