Event Sheet Start

0 favourites
  • 10 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • 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

  • Strange..I've the same structure, but no problems/ I check my project and if I found a solution I'll give you.

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

  • Try Construct 3

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

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

  • I'll give those suggestions a try.

    Thank you.

  • If those suggestions don't work, I will upload it. Thanks.

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

    iretrogames.com/gc/GroundControl.capx

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

    Global variable timer = 0
    
    +System: Every tick
    ->Add dt to timer
  • Ahhhh, thank you so much :).

  • Got it working, thanks so much for the help.

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