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

0 favourites
  • 4 posts
From the Asset Store
20 high quality click sounds, ready to improve your game's UI instantly
  • 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

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

  • Try Construct 3

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

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

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

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