The instance being inspected was destroyed?!?!?

Get help using Construct 2

Post » Sun Apr 27, 2014 11:44 pm

I was making a store for my game where you could customize your character through animation frames. This is what I did: On touched "spr_buy" => Set instance variable of "spr_player" to 1. Then after this, in the actual game part event sheet I put this in this: If spr_player instance variable = 1 => Set animation frame to 1. This wasn't working so I tried to debug my game. When I went to the store and bought the customization the instance variable did change to 1 but when I clicked the back button in the store to go back to the actual game the debugging panel said this: The instance being inspected ('spr_player' UID 35) was destroyed. Why?
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Sun Apr 27, 2014 11:46 pm

Are your shop and game on same layout? Or they are two different layouts?
ImageImageImageImage
B
157
S
64
G
41
Posts: 2,590
Reputation: 34,640

Post » Mon Apr 28, 2014 12:05 am

Two different layouts @shinkan
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Mon Apr 28, 2014 12:12 am

That's the reason. Objects are destroyed between layouts. Only global objects are stay the same. You can make your object global, so it will not be deleted on switching layouts. But for that kind of shop customization I would use array or dictionary, or even global variables if you have only few modifications for character.
Then if you change something in the array it will stay the same on all layouts until you change this value to something else.
ImageImageImageImage
B
157
S
64
G
41
Posts: 2,590
Reputation: 34,640

Post » Mon Apr 28, 2014 12:17 am

@shinkan Thank you very much!!!! The rest of my game was complete except for the store. Now I can fully finish it :D
B
37
S
14
G
3
Posts: 263
Reputation: 4,270


Return to How do I....?

Who is online

Users browsing this forum: MoscowModder, Yahoo [Bot] and 6 guests