How do I keep a sprite pinned after switching layouts?

Get help using Construct 2

Post » Tue Apr 08, 2014 2:37 pm

I have a blank sprite with the platform behavior with an animation pinned to it. It works fine on the first level of the game, but after completing the level and switching layouts, the pinned animation sprite disappears on the second layout. I'm using one even sheet for all the layouts with System>On start of layout>animationsprite>pin pin to>blank sprite(position and angle) . Is it possible to do this using only one event sheet or will I need an event sheet for each layout to get the animation to pin correctly?
B
51
S
17
G
2
Posts: 111
Reputation: 4,511

Post » Tue Apr 08, 2014 4:30 pm

For some reason i do not like the pin behavior.what works for me every time is to create an imagepoint for your sprite where you want the other object to "pin" and then use
every tick----- set position to another object imagepoint whatever you want.
do not use this code underneath "on start of layout" just use it normaly as an condition.
and do not forget to go to the second layout properties and assign as an event sheet,
the event sheet you have.i believe that is the reason that it does not pin.
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Wed Apr 09, 2014 11:57 am

It depends as well on when you create each object - you can't pin what's not there yet. I'm guessing you're using global objects for this in the belief that they will transfer over; I've also found global objects to be inconsistent this way so I start my common event sheet with a bunch of create object commands instead.
A big fan of JavaScript.
B
76
S
20
G
74
Posts: 2,257
Reputation: 46,488

Post » Wed Apr 09, 2014 7:06 pm

Thanks for the replies guys, it was actually an overlook on my part where I deleted the empty sprite on my other layout and didn't notice because it was behind my animation sprite. Roccinio, the pin behavior is working fine for me on a 100 level game with one event sheet. Colludium, not using global objects, new objects in every level, just got them all in one event sheet.
B
51
S
17
G
2
Posts: 111
Reputation: 4,511


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests