PIN behavior breaks after Layout change

Discussion and feedback on Construct 2

Post » Wed Sep 14, 2016 5:15 pm

Hi everyone. I'm facing a problem here and will try my best to describe it as clear as possible (not english native).

My game have 2 layouts:
Layout 1 - The board
Layout 2 - Sprite creator selection screen

On Layout 1 i have a button that sends me to layout 2 where have some buttons for character selection. When I select a character a global variable is set to true (along with other variables) and I get back to layout 1. When layout 1 loads it check the variable and if its true it creates the objects and pin them, this is working fine.

The problem is that when I repeat the process to create another sprite the previous ones created ones have their pins breaked. Its not a problem with Persist, both the sprites are created correctly but the previous one looses its PIN behaviour, only the new one get its PIN.

As test purpose I made 2 buttons on layout 1 with the same function as above and it works pretty well. So the problem probably on the Layout chage. I have more than 50 sprite creator and really want them to have theyr own layout.

Anyone have a solution or an idea to test? Thanks


Edit: CAPX HERE
B
21
S
7
Posts: 37
Reputation: 1,442

Post » Wed Sep 14, 2016 8:14 pm

I have no idea why the pin is not recalled by the persist behaviour.

Some one brighter than me will probably find the cause or mark it as a bug.

In the mean time, if you need a workaround, here is one, by 'assisting' the persist. Just 'mimic' what it supposed to do:

https://www.dropbox.com/s/2g6q5digc7wky ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Sep 14, 2016 9:26 pm

Thanks a lot @99Instances2Go.

That worked =D
B
21
S
7
Posts: 37
Reputation: 1,442

Post » Thu Sep 15, 2016 12:55 pm

@99Instances2Go still got a problem with this behavior.

I add a button to go to Layout 3 and on Layout 3 i have a back to layout 1 button. When it goes back it looses the behavior as well. I add your code to "layout 1 -> on load" but it still looses the behavior. Do you have any idea to persist?

CAPX with back buttons
B
21
S
7
Posts: 37
Reputation: 1,442

Post » Thu Sep 15, 2016 3:44 pm

You dont secure the state before going to layout 3, as you do before going to layout 2.
Just do the same. Button clicked ... backup ... change layout.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Sep 15, 2016 6:28 pm

Thanks, i missed that.
B
21
S
7
Posts: 37
Reputation: 1,442


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests