On Destroyed Bug after Loading Game State[gamebreaking bug!]

Report Construct 2 bugs here.

Post » Sat Jan 13, 2018 7:23 pm

Problem Description
When an instance is destroyed, and then the game state is saved, loading triggers On Destroy to misfire after the page is reloaded or newly run.

edit: btw, if you have multiple on destroy events, you can have multiple misfired events depending on how many destroyed instances there were when you saved.

Attach a Capx
https://1drv.ms/u/s!AhHSZHEulqh_ghA3H7Y-hEbKcJ1h

Description of Capx
Destroys a sprite via hitting number 2 Key.
Game state is saved via hitting F3.
user reloads the page.
Game state is loaded vis hitting F4.
The bug occurs, misfiring the on Destroy triggers.


Steps to Reproduce Bug
  • hit number 2 key
  • hit F3 to save
  • reload page
  • hit F4 load

Observed Result
on destroyed triggers are misfired (bug occurs)

Expected Result
for the triggers not to malfunction.

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (YES)

Operating System and Service Pack
vista sp2

Construct 2 Version ID
__r250
B
53
S
24
G
70
Posts: 1,201
Reputation: 41,430

Post » Tue Mar 06, 2018 5:57 pm

Here is more information I discovered while trying to find a work around.

I used a global variable and set it to 1 before loading. Then on destroy events, I add condition to check if variable is 0.
It seems the On Destroy fires BEFORE loading (when everything is destroyed), and the resulting actions in that event are performed AFTER loading.
B
53
S
24
G
70
Posts: 1,201
Reputation: 41,430

Post » Wed Mar 07, 2018 1:51 pm

Well, this is currently by design. If you load a savegame with fewer instances, the additional instances are destroyed. Destroying instances triggers 'On destroyed'. I guess we could change this though to skip those triggers.
Scirra Founder
B
415
S
248
G
92
Posts: 25,284
Reputation: 200,952

Post » Wed Mar 07, 2018 4:37 pm

I don't really see any reason why anyone would want the triggers to fire when loading a savegame- especially when it results in a game state that was different than when it was saved.
B
53
S
24
G
70
Posts: 1,201
Reputation: 41,430


Return to Bugs

Who is online

Users browsing this forum: No registered users and 3 guests