How do I permanently destroy objects

Get help using Construct 2

Post » Fri Sep 15, 2017 8:54 am

I looking for a way to permanently destroy collectible objects in my game I'm using the persist behavior which works between layouts/levels but the objects comes back when restarting the game
B
9
S
4
Posts: 15
Reputation: 755

Post » Fri Sep 15, 2017 10:02 am

You need to store the state of your collectible objects somewhere (save to local storage for example).
When your game is restarted, retrieve this data and if the collectible object is already collected, just destroy it on start of the layout.
Check out my awesome game Doptrix
B
17
S
8
G
9
Posts: 205
Reputation: 6,399

Post » Sat Sep 16, 2017 6:20 am

Is there another way to do it, I'm using the local storage to remember levels as to progess through the game and at the moment I have it so you have to collect the coins to complete the level there for unlocking the next level, I was hoping to change it so you could complete the level and unlock the next one without collecting the coins and have the coins as an extra challenge then have unlockables you can buy with the coins but I cant seem to get it to save or load a 2nd number and I was also trying to avoid using that method as it would require them to be collected in order to work
B
9
S
4
Posts: 15
Reputation: 755

Post » Sat Sep 16, 2017 6:58 am

You really need to add some punctuation like full stops and question marks. It's hard to understand you.

You should use Local Storage to store data between gaming sessions.

Player opens your app -> you load everything from Local Storage. If player owns any unlockables, you add them to player's inventory and remove/destroy them from the shop.
During the gaming session you store progress, coin balance and unlockables in data objects (global variables, arrays, dictionaries, whatever suits best).
When player completes a level or makes a purchase in the shop -> you save progress, coin balance and unlockables to Local Storage.
Check out my awesome game Doptrix
B
17
S
8
G
9
Posts: 205
Reputation: 6,399

Post » Sat Sep 16, 2017 10:12 am

Thanks, but not really helpful actually trying to avoid everything you just said. Sorry it was hard to understand but the first words were (is there another way..) to your first suggestion for using local storage
B
9
S
4
Posts: 15
Reputation: 755

Post » Sat Sep 16, 2017 10:40 am

You can use the system save game to slot event that will store an image of the game and the state it's in at the point of saving including the state of the destroyed objects. I don't see what your problem is with using local storage though, if you are already using it.
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187


Return to How do I....?

Who is online

Users browsing this forum: newt and 8 guests