BUG with JSON?

Discussion and feedback on Construct 2

Post » Mon Nov 06, 2017 11:56 am

Hello, in this program the variable Z of the sprite does not recover the value with which it is saved in JSON.
The sprite should not be destroyed.

The sprite is destroyed because its variable Z does not match the state saved in JSON.

Image

https://www.dropbox.com/s/mr9ec14ekmubbg2/testJSON.capx?dl=0

If this is a bug and someone wants to report it, then you can use my capx file, I do not speak English and it is complicated to fill out a report so that it is understandable.
B
30
S
13
G
21
Posts: 838
Reputation: 14,656

Post » Thu Nov 09, 2017 8:38 pm

Please, can anyone give a review to this?
Is it a bug that can be solved ?.
B
30
S
13
G
21
Posts: 838
Reputation: 14,656

Post » Fri Nov 10, 2017 2:57 am

You can look at the json to see what's different. I imagine the uid of an object is part of the json but it's not used when loading.
B
94
S
33
G
114
Posts: 5,357
Reputation: 73,775

Post » Fri Nov 10, 2017 7:19 am

R0J0hound wrote:You can look at the json to see what's different. I imagine the uid of an object is part of the json but it's not used when loading.

The problema is the variable "zi", this is Z INDEX.
When the state is loaded in JSON the variable ZI is not assigned then the difference occurs.
B
30
S
13
G
21
Posts: 838
Reputation: 14,656

Post » Fri Nov 10, 2017 8:22 am

Well, the z index is probably something that isn't loaded either. I mean no two objects can have the same z index.
B
94
S
33
G
114
Posts: 5,357
Reputation: 73,775

Post » Fri Nov 10, 2017 9:05 am

But this causes me a problem, I need this value to be saved and assigned correctly.
I'll check if this has a solution.
The variable ZI is saved in JSON but then it is not assigned correctly and the difference occurs.
The UID is not saved in JSON.
B
30
S
13
G
21
Posts: 838
Reputation: 14,656

Post » Fri Nov 10, 2017 10:21 am

A new instance cannot have the same Z as another already existing.
Otherwise you could not precisely order instances in the Z Order Bar.

I don't think this is a bug.

@Ashley, @Nepeo, @DiegoM any of you guys could confirm this theory please ?
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
294
S
117
G
96
Posts: 7,310
Reputation: 71,084

Post » Fri Nov 10, 2017 10:23 am

So the utility of saving the variable zi in JSON is questionable.
B
30
S
13
G
21
Posts: 838
Reputation: 14,656

Post » Fri Nov 10, 2017 10:59 am

I don't think it's a bug. As mentioned, you can't create two instances at the same Z index, so it doesn't try to restore it. For example if you didn't have the 'Destroy' action then it's impossible to restore the correct Z index when you create another instance. It's also not possible to restore if you save it with a Z index of something like 100, but there are only 10 instances.

One workaround could be to save the Z index to an instance variable and figure out how you want to deal with these edge cases after loading the instance.
Scirra Founder
B
399
S
236
G
89
Posts: 24,527
Reputation: 195,386

Post » Fri Nov 10, 2017 6:10 pm

Ok well I think I have a solution but the truth is that I find it a bit useless what happens with Z Index.
Currently you can not compare states in JSON because Z Index does not match and the status will always be different in my case.
B
30
S
13
G
21
Posts: 838
Reputation: 14,656

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Niespor, warmty, wertt22 and 14 guests