[RESOLVED] Restart level & keep chckpt attribute

0 favourites
  • 6 posts
From the Asset Store
In this template the music plays without looping in your game
  • 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.

    <img src="https://dl.dropbox.com/u/26046730/Restart_checkpoint%20not%20working.png" border="0" />

    <img src="https://dl.dropbox.com/u/26046730/002.png" border="0" />

    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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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 ;-p

  • 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.

  • 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 :(

  • 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:

    <img src="https://dl.dropbox.com/u/8367729/construct/pics/checkpointProblem.png" border="0" />

  • 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.

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