[Plugin] instance bank2

  • This is a sampe capx to save & load specific instance to/from instance bank.

    There are 3 sprites in this capx with different private variable "i".

    1. save each instance into an empty instance bank, then save the content of instance bank (JSON string) into dictionary. (replace dictionary to webstorage if required)

    2. destroy all sprites

    3. load content from dictionary into instance bank then load all sprites

  • Update:

    Fix bug at clean bank. Thanks for Joannesalfa 's notification.

    Now previous sample will save one instance directly.

  • rexrainbow Thank you! :) finally, it's great plugin to manage the instances to keep logic performance.

  • Hi rexrainbow!

    I have a issue.

    As sprites spawn on screen a event saves all instances of that sprite into the instancebank.

    Then i destroy the sprites by clicking on them.

    Then i press load, and the sprites are loaded from the bank and appear on screen again.

    Because of the event that says to save when i spawn the sprites, it creates doubles.

    So i added a extra action when i press load, to first clean the instance bank, then wait a second then save all instances.

    But it seems like the instancebank is not cleaning.

    Because i stil get doubles.

    Strange...

    Do u have a sollution?

    Kind Regards.

    Savvy001

  • Update.

    I cheated the plugin a bit to make it work.

    I added another instance bank which i left empty.

    Then to clean the first instance bank i load a json from the second instance bank.

    Which is empty <img src="smileys/smiley2.gif" border="0" align="middle" />

    Now i dont have doubles with the above explained issue.

    Kind Regards.

    Savvy001

  • Hi, can't DL the example files, server problem ?

    thx

  • Savvy001

    "the instancebank is not cleaning" , yes, it is a bug I had fixed. You might download this plugin again.

  • Thanx rexrainbow!

    Just downloaded, i indeed had the old version.

    Kind regards.

    Savvy001

  • Savvy001

    Sorry, my bad.

  • Hi Rex,

    First off, great job on your plugins, you made some really amazing tools!

    I am using Instance Bank, to save and load my levels out of a big layout, it works good on everything except for moving platforms with sine behavior, i have some platforms with different 'Sine period offset' value, to sync their movement, when i reload these instances their movement is out of sync, i can bypass this problem by adding another var with this value, i just wondered if you are aware of this problem and if it is something you might consider fixing.

  • Can't DL

    p1ay.allalla.com/C2TestCapx/instance%20bank%20-%20save%20to%20string.capx

    or anything from p1ay.allalla.com

    for days, anyone ?

    thx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • johnnyl7x

    I can not connect my server today. I will pm you if the server is activated.

    (But my friend could connect my server and download this file... <img src="smileys/smiley18.gif" border="0" align="middle" /> )

  • Save bank to webstorage / load bank from webstorage

    "expression: BankToString" could transfer all bank date to JSON string, then write this string to webstorage.

    "action: Load bank from JSON string" could load bank from JSON string picked above step.

    This flow is the same as sprite bank plugin.

    <img src="http://i1081.photobucket.com/albums/j352/rexrainbow1/file-6.png" border="0" />

  • "condition:on saving" , "condition:on loading" will be triggered when saving/loading each instance, to do some customize actions or saving custom data by "action:set info", to read them when loading, use "expression:SavedInfo".

    See the first post of this thread, at the last capx.

    In your case,

    + "condition:on saving"

    • "action:set info" <- save the parameters of behaviors

    + "condition:on loading"

    • set the parameters of behaviors from "expression:SavedInfo"
  • Any way to save to a file ? for PC and other ports.

    It still write to web storage ?

    It is Not safe & don't work on PC port.

    thx

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