Event Sheet Start

Get help using Construct 2

Post » Sun Jul 08, 2012 6:23 pm

Hey All,
For some reason I can't find any good information on my issue, but it seems so basic I am sure I am doing something wrong.

I have 2 layouts and 2 event sheets.

Layout - Start
Event Sheet 2

Layout - Main
Event Sheet 1

Start is my start page. Has a button to "Click to Play". I am making that button go to Layout Main, which is my game. However, my game is based a lot on time. For example the first group of enemies come in around 10 seconds in. However, when I first load up the project in my browser, the events from my main game have already started, even though that layout isn't on screen yet. So if you wait for a while before pressing "click to play", you start and there are enemies on the screen already.

My question. Is there a way to stop an event sheet from starting until the layout is actually active?

I hope I am explaining this well.

Thanks
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sun Jul 08, 2012 6:33 pm

Strange..I've the same structure, but no problems/ I check my project and if I found a solution I'll give you.
B
23
S
5
G
5
Posts: 112
Reputation: 4,737

Post » Sun Jul 08, 2012 6:38 pm

Here's a few ideas:

Have your Layout Main events grouped
in Layout Start > Start of Layout > Set Layout Main group inactive
in Layout Main > Start of Layout > Set Layout Main group active

Have a global variable "Game_Started" set to 1 once you go to Layout Main; only start your spawns or main game events if Game_Started = 1

If you are using Time Delta (which you should be if possible):
in Layout Start > Start of Layout > Set time scale 0
in Layout Main > Start of Layout > Set time scale 1

I think setting groups of events to active / inactive is the easiest solution (groups can also be nested). Hope that helps.
B
9
S
2
G
3
Posts: 75
Reputation: 1,964

Post » Sun Jul 08, 2012 6:40 pm

If you upload a .capx to dropbox we could have a look. Makes it easier to see what's happening.

(Save your project as single file, register a free account on dropbox.com, put the file in the public folder, right click the file, select copy public link, paste on forums)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Jul 08, 2012 6:42 pm

I'll give those suggestions a try.

Thank you.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sun Jul 08, 2012 6:42 pm

If those suggestions don't work, I will upload it. Thanks.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sun Jul 08, 2012 6:57 pm

OK, I can't get anything to work. I've tried a ton of things now.

Here is my capx, sorry it's kind of big, I have two music files in the game as well.
www.iretrogames.com/gc/GroundControl.capx
ArcadEd2012-07-08 18:57:50
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sun Jul 08, 2012 7:05 pm

Okay, the problem is you're using the "Compare Time" condition. This condition returns the time in seconds since the game started. It doesn't matter which layout you're on.

What you could do is create a new global variable "timer", and add 'dt' to that variable every tick in event sheet 1. Then compare this value instead of using "Compare Time".

[code]Global variable timer = 0

+System: Every tick
->Add dt to timer[/code]Nimtrix2012-07-08 19:06:14
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Jul 08, 2012 7:06 pm

Ahhhh, thank you so much :).

ArcadEd2012-07-08 19:07:22
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Sun Jul 08, 2012 10:01 pm

Got it working, thanks so much for the help.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Next

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], DiabloOvermind, emoticon, MrWhizm and 15 guests