I have a splash screen layout with a simple intro game instruction
screen that I run to start my game...
The user can click a "START GAME" button or "NEXT" button to continue thru the instructions...
QUESTION: What am I doing wrong???
While the SPLASH layout is loaded and running my GAME layout
is already STARTING and when I click the START GAME button it appears as if the GAME LAYOUT has been already running..
I have characters using a loop "On every X Seconds" that appears to have already executed prior to the GAME layout being viewed...
Just to clarify...
While my SPLASH layout runs..
My actual GAME layout appears to already be running...
When I START GAME, the game appears to be under way already...
Develop games in your browser. Powerful, performant & highly capable.
Oh God ! Why don't you people understand ! We can't practise telepathy ! If you want help post a .capx that reproduce your problem or atleast a pic of your event sheet !
Hey Whiteclaws, if you can't help, don't help..
I'm new here, so I apologize if I offend your experienced viewpoint..
I have a starting layout..
This layout is the FIRST thing a player will see..
This layout will explain the game concept..
When I click my START GAME button and go to my actual GAME layout.
The music is already playing and my enemy, which appears
"Every X Seconds" is already tossing objects..
So, it APPEARS that the actual game layout starts running
while I'm viewing the START / SPLASH layout...
I honestly don't know how to explain it any more clearly..
You could explained like that from the start ...
Make a variable " OnGameStarted " ( Starts with 0 )
And add this action to your " on clicked : Start Game ( Button ) "
Set " OnGameStarted " to 1
And add to all your events that start when the actual game layout starts
if "OnGameStarted" = 1
Also , Please take note that we are here to help you ... I'm not trying to be rude , but try to be at my place , I can't imagine your game in my mind ... I helped more than 100 buddies here and i'm really proud of myself !
Just ask , I'm here to help you ...
White Claws Take a Chill. There is nobody here but us chickens and you were once a yolk too! Don't make us have to send you to your room and take away all of your exclamation points. <img src="smileys/smiley18.gif" border="0" align="middle" />
Whiteclaws - I realize that's not what you intended, but the tone of exasperation comes off as unfriendly. I understand why you would be frusterated by people commonly not describing their problems enough for others to help them, but please don't vent those cumulative frustrations at anyone, as doing so could make people feel less welcome, and we certainly wouldn't want that! We're got a reputation as a friendly community to maintain. :)
It's a common mistake for people to make, ecpecially for users new to construct. Simply please ask them to explain in more detail and/or provide a capx.
balistrerinick - even if it seems clear to tou, it might not be clear to us. Providing a capx and/or a screenshot of your code will help us help you. Please always provide them if possible, it makes things much easier.
First, I want to thank everybody on C@ forums for any help/advice they offer.. I was using GameMaker up until about 2 weeks ago when I stumbled on Construct 2 and I LOVE IT..
I've been able to spend more time on my game and less time wrestling with the quirks and bugs of the environment..
Second, want to thank Whiteclaws for the suggestion regarding the use of a Global Variable instead of using the "On Start of Layout"..
Seems like the "On Start of Layout" should execute on the start of a layout, but ok...
So, moving my starting positions and music to a Global variable test condition worked..
However, I have an enemy sprite character that pops up on screen and throws objects based on the SYSTEM: "Every X Seconds" routine..
This routine appears to be already executing.. Again, upon clicking the START GAME button, the character has already begun tossing objects..
Any ideas about how I can start the "Every X Seconds" routine only upon CLICKING the START GAME button on my opening SPLASH screen?
One last thing, I'm honestly not sure what you all mean by capx...
By the way, what confuses me most in all this is that, I would assume that each layout screen and it's associated events would only begin executing when that layout is ACTIVATED..
I thought that using the "On Start of Layout" was the correct method..
So, ALL SYSTEM events occur on every layout even when they are not ACTIVE??
I guess I thought that each layout had it's own SYSTEM events that execute when that layout is ACTIVATED..
Any help ???
That just doesn't sound like correct behavior from the engine. I'd be curious to see your events, too, just to see what's going on. I've never had behavior like that out of my games.
And a .capx is the file extension for C2 files. On File>Save As ... You can choose to save as an all-in-one file (project.capx for example), or as a project with resource folders. If you save it as a capx, then you can share that single file and there won't be any file dependency issues. If you prefer it otherwise, don't worry, you can re-save to either format at any ime. I hope that helps!
I wanna thank everybody for all their help..
Here's an update, I have 2 "Every X Seconds" loops on my MAIN game layout.
When my game starts on my SPLASH layout, I added a TEXT field to display a message following a global variable to show me if either of these loops has actually executed. So I'm sure that these loops do not execute until the MAIN layout starts.
However, what is definitely happening is that the timer for this function "Every X Seconds" has started and, upon starting the MAIN layout, BOTH loops execute IMMEDIATELY,
These loops are set as follows - "Every Random(10,30) Seconds".
So, I would expect that, upon the START of my MAIN layout, that there would be a MINIMUM of 10 seconds before the loop would begin.
However, it appears that the loop timer has fired and waiting for the MAIN layout to START then it executes IMMEDIATELY.
SO, it is true that the loop does NOT execute until the MAIN layout starts, however, the timer does begin already.
I have isolated this problem thru adding conditional global variables which do indeed prevent the "Every X Seconds" loops from starting..
However, I can confirm now that the "Every X Seconds" loop timers
do count off regardless as to anything i have tried.
"Every Random(10,30) Seconds" loop includes a conditional global variable that prevents it from executing until a START GAME button on the SPLASH layout is clicked.
However, upon the MAIN game layout starting, there "should" be a minimum 10 seconds before the "Every Random(10,30) Seconds" loop begins.
This loop executes immediately upon the START of the MAIN game layout.
This tells me that the timer has gone off and is simply waiting for my additional variable to be SET to execute the loop itself.
So, my question has been revised..
Is there a way to prevent the "Every Random(10,30) Seconds" timer from starting ONLY when my MAIN game layout is activated???
I hope this all makes sense. I've been programming for many years and I am NEW to using "Construct 2" so the environment and it's quirks are still new to me...
I'd use a timer variable for these cases when you want precision - I generally reserve 'every X seconds' for simple foolproof cases.
To use a timer variable, just add dt to it every tick and it will up one increment every second. Then you can reset this and compare it at your whimsy.
Welcome to C2!
I will post my events sheet for each layout and hope I can find a solution..
Basically, I've had to add global variables to keep my MAIN game layout from executing. This works for now, but, I do want to solve this at some point..
Thank you for all the help :)
Sorry it's taken me so long to get my act together here at Construct2.
Every programming language and environment seems to has it's own unique
quirks and eccentricities.
Anyway, here is my "For X Seconds" loop. It uses a random timer which
goes off and my character throws an object. My problem remains that the "For X Seconds" timer appears to be going off while my SPLASH layout is being viewed. When a use clicks the START GAME button and my main GAME layout displays this "For X Seconds" loop has already executed.
UPDATE: Since I'm new to C2, I finally got around to exporting my game to the actual HTML5 web files and I noticed that my Main Game layout is called "sheet0", and since I created my SPLASH layout afterward, it is called "sheet1".. I don't know if this matters...
<img src="http://i.imgur.com/Y6HHn.png" border="0" />