[PLUGIN] Sprite Bank

Post your completed addons to share with the community

Post » Sun Apr 08, 2012 1:54 pm

I'd like to just chime in here a quick moment to say thanks so much for this one! I just used it in a project and it's plain awesome.

When I used to use GameMaker, it had an automated Save/Load feature and I believe it used exactly this method, saving all object instances. It's so nice to have this feature here in Construct 2, but in a more powerful way. It's totally possible to save the JSON string to the server, or even display it so users could copy-paste if needed.

Excellent work and thanks again!
B
126
S
7
G
4
Posts: 185
Reputation: 7,233

Post » Fri May 11, 2012 3:27 pm

Update:

Remove jQuery call.
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Thu Aug 23, 2012 12:42 am

@rexrainbow, will need to get further along in my game before using this, but it will definitely be helpful when I do, thanks.
B
28
S
4
G
3
Posts: 70
Reputation: 4,874

Post » Sat Nov 24, 2012 4:40 am

I found out tonight, if you are saving the json anywhere to be used at a later date, the plugin will throw an error if you add any new instance variables to your game after the json has been generated. I'm not sure how people are using the sprite bank like this (in my case it's for a map editor).

It's easy enough to jump in and fix the json, but it's still probably good to be aware of before making sweeping changes to your game.
B
24
S
4
G
1
Posts: 244
Reputation: 3,462

Post » Sat Nov 24, 2012 8:04 am

@boolean

C2 engine stores instance variables in a list.
It is hard to keep compatible if user add or change the order of instance variables.
For example:
Save the instance variables
[code]x: 10
y: 20[/code]
to JSON will be
"[10, 20]"

Now user insert another instance variable
[code]i: 3
x: 10
y: 20[/code]
The JSON should be "[3, 10, 20]".

or
[code]x: 10
i: 3
y: 20[/code]
-> "[10, 3, 20]"



Any suggestion for these situation?rexrainbow2012-11-24 08:07:22
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Sat Nov 24, 2012 8:16 am

I would like to make another version of sprite bank for board system (might be named chess bank), but still have not enough time.

Does any one use sprite bank to save chess(sprite instances) on board plugin?rexrainbow2012-11-24 08:16:48
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Sun Dec 02, 2012 5:06 pm

[QUOTE=rexrainbow]Any suggestion for these situation?[/QUOTE]

So what I did to get around the error was I made a small change to the runtime.js. On line 161 I changed:
     
inst.instance_vars = save_obj["inst_vars"].slice();

to

while(inst.instance_vars.length > save_obj["inst_vars"].length)
   save_obj["inst_vars"].push(0)
inst.instance_vars = save_obj["inst_vars"].slice();


It means if you have any instance variables set through the IDE (that spritebank does not know about) they will be reset to 0, but it at least lets you load the spritebank so you can resave the json.

I guess this doesn't solve the problem posed by you if you are updating instance variables through the IDE. That I'm not sure of, I think I need to learn more about how plugins work boolean2012-12-02 20:12:29
B
24
S
4
G
1
Posts: 244
Reputation: 3,462

Post » Sun Dec 02, 2012 5:26 pm

@boolean

Thanks. I will add it into plugin.

I might upgrade this plugin to support save more sprites like instances in container. Uh, hope I have time.
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Mon Dec 03, 2012 4:02 am

I don't know if I mentioned this yet Rex, but your Sprite Bank was a godsend for my last game and likely will be for my next as well. So thanks a ton a ton a TON for this!
B
56
S
20
G
7
Posts: 305
Reputation: 8,754

Post » Mon Jan 14, 2013 4:16 am

I haven't mentioned this Rex, but I love you :D in a platonic respectful way. I had noticed the spritebank a few months ago, but it was only over the weekend that I decided to work on a User Generated Content game. Also I needed a way to do a level save and loader.

By using families and using instant variables I can build levels. Your Spritebank works like a charm in regards to JSON to text, text to JSON and it stores the family behaviours. I love you.
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 7 guests