There are 2 issues here:
1. Major concern: after loading the game, "Every x sec" event may stop firing after a long random interval before it fire normally again . ( I have tested this throughly and have provided explanation below )
2. Tracking values for "every x sec" are not reset in layout restart and layout switching.
Attach a Capx
For the 1st issue:
I am facing a bug in the game I am making: every x sec stops firing. In my game, the issue arises when the game re-loaded the saved checkpoint. (the player returned to checkpoint layout) After I proceed to some other layouts, I see that some "every x sec" stop firing entirely.
Steps to Reproduce Bug
To replicate this issue with capx above, please proceed with "debug layout". Please take a look at system time, wall clock time, etc. for this, while following the steps below:
- 1. Starting in 1st layout. At 5th second of system time, hit "S" to save, and you should see "save complete" text as a confirmation.
- 2. Now hit "2" to go to the 2nd layout. The 2nd layout has a blue square that will shoot some objects every 0.2 second. Wait until system time is 15th second, hit "L" to load. Your save should now be loaded and you should be back at the 1st layout and see "load complete" text. All the times should now be back when they were saved.
- 3. Now, hit "2" to go to the 2nd layout. You will see the blue square does not fire every 0.2 sec at all. However, if you wait until the time you load (15th second in this case), the blue square will start firing again.
I suspect that the value of time used for checking in "every x sec" still uses the old value before loading. However, what is strange is that the red square still fires its object as usual. So I dived in further to assist you in this case:
There are 3 layouts: Layout 1, 2, and 3.
There are 4 event sheets:
- Ev_BoxCtrl is the one with code for spawning the blue balls from the red square.
- Ev_KeyboardMouse contains all the keyboard codes and save/load.
- Ev_main simply "includes" Ev_BoxCtrl and Ev_KeyboardMouse above.
- Ev_Layout2 includes "Ev_main" and contains the code spawning blue balls from blue box every 0.2 sec.
Layout 1 and 3 uses Ev_main event sheet, while Layout 2 uses Ev_Layout2 event sheet.
Furthermore, I see that this issue will not occur if I move the code for spawning blue balls from blue box every 0.2 sec to Ev_main event sheet. In the game we are making however, we once see "every x sec" in the "included" event sheets have this issue as well after loading the game.
This issue is our primary concern right now, and we would like it to be fixed. Could you please investigate?
For the 2nd issue:
The first time you load the layout, the blue ball will be spawned from the red box after 1st sec. Then again in the next second and so on. Now, hit "R" to reset the layout rapidly. You will see that even though the layout got reset, "every 1 sec" will fire in a way like without having the value reset. For example, if you reset the layout at 0.75 seconds after the layout start, "every 1 sec" will fire at 0.25 seconds after the restart.
For small values in every x sec, this could be negligible, however, suppose we have something that fires every 60 sec, imagine if you reset the layout, and this time you reset, it fires before the first 60th second of this layout being played.
I've also tested this by changing layout around. In capx, hit 1, 2, 3 to change to the layout 1, 2, 3 around, you will see that this issue also applies to layout switching.
Operating System and Service Pack
Win 7 64 bits
We have only tried with NodeWebkit and Chrome Version 34.0.1847.116 m.
Construct 2 Version ID
R163 64 bits (this issue also occured with R152)