Resetting a Layout

For questions about using Classic.

Post » Thu Jan 13, 2011 11:34 am

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!
B
8
S
2
G
2
Posts: 144
Reputation: 1,588

Post » Thu Jan 13, 2011 12:04 pm

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.

[quote="spacewarguy":38d2z57v]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. [/quote:38d2z57v]

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.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Thu May 31, 2012 7:59 am

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.
B
3
Posts: 1
Reputation: 277

Post » Thu May 31, 2012 5:26 pm

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.
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Sun Jun 03, 2012 2:27 pm

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....
B
8
S
2
G
2
Posts: 144
Reputation: 1,588


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests