Resetting a Layout

This forum is currently in read-only mode.
From the Asset Store
MM_Preloader
$19.99 USD
Various preloading features. Preload textures of entire layout, custom preloading, etc.
  • I am not a very advanced user of Construct, so this may or may not be a stupid question.

    I am making a top down shooter where the player fights through armies of soldiers. Problem is, the player is going to die a lot. I am having trouble with respawning however. So far, I have set it once you die to go to another layout, saying you die etc., and then another button goes back to the game layout where the player has another go at the level.

    Problem is, even though the layout seems to restart, certain events seem to not work. Events that are set to happen every couple of milliseconds do not work. For example, the players shield and weapon energy, which go up every certain amount of time, simply do not anymore.

    Why is this so? Can I fix this, or is there a better way to restart the layout/level? Help would be greatly appreciated!

  • You restart a layout by using the "Go the layout" action and specifying the same layout you're currently in. Just in case it wasn't clear you could do that.

    Problem is, even though the layout seems to restart, certain events seem to not work. Events that are set to happen every couple of milliseconds do not work. For example, the players shield and weapon energy, which go up every certain amount of time, simply do not anymore.

    There's no good reason why these kind of events shouldn't work anymore once you go back to the same layout. Unless you're having them in a group, which you deactivated for some reason.

    It usually has something to do with the way you set up your events. So it would be mighty helpful to see your cap.

  • I had this exact same problem. To fix it I had the following actions after clicking the reset button (or player dying in your case)

    System | Set time scale to 1.0

    System | Reset global variables to default

    System | Go to "restart"

    The layout named "restart" is a black layout that has the event to go to the main game screen every tick so when the player restarts the game relays through this layout back to the main game screen.

    Hopefully this might help but it's hard to tell without looking at exactly what your game does and what you want it to do.

  • I'd like to hear what spacewarguy figured out since posting, and if Markin2D's code advice helps. I've had problems with this in the past myself, so I'm going to keep an eye on this thread for future reference.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hm... well this is an old thread of mine... although it was awhile ago, and it was probably one of the first experiments of mine... I think it was as simple as the transitions were messing with the time events. Deleting those seemed to fix it. But I can't remember much, so....

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