Save the instance variable value for one sprite for each iid

Discussion and feedback on Construct 2

Post » Wed Aug 02, 2017 3:00 pm

Hi
I wanted to know how I could change the instance variable of a spritate I've played a lot of them. I thought I might have done this with arrays, but I do not know how. Help me please
B
2
Posts: 2
Reputation: 154

Post » Thu Aug 03, 2017 5:00 am

please help me.
B
2
Posts: 2
Reputation: 154

Post » Fri Aug 04, 2017 5:51 pm

change or save ????

you can use an array or a dictionary to store all instance variable(s) for all instances of sprite.

for a array something like

+ System: For each Sprite order by 0 ascending
-> Array: Set value at (0, LoopIndex) to Sprite.​myinstancevariable


if you want to save like a game save
set the array above to a local storage object in json format

+ Button: On clicked
-> LocalStorage: Set item "Save" to Array.​AsJSON



but if you are doing this save game file then construct 2 has a save game feature that saves the whole state of the game, no arrays needed

https://www.scirra.com/tutorials/526/how-to-make-savegames
My in work shmup game CYBERSTORM DEVLOG - "That Terminator is out there. It can't be bargained with. It can't be reasoned with. It doesn't feel pity, or remorse, or fear. And it absolutely will not stop, ever, until you are dead"
B
47
S
25
G
7
Posts: 372
Reputation: 8,450

Post » Tue Aug 08, 2017 8:44 am

Thanks for the good information.











m8bet
Banned User
B
2
Posts: 4
Reputation: 158


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 14 guests