How do I unpin one sprite from a chain of pinned sprites

Get help using Construct 2

Post » Sun Oct 16, 2016 1:39 pm

HI guys,

I'm using one sprite (ball shadow) pinned to another (ball itself), and the ball pinned to a backgroung image sprite. What i'm trying to achieve is when the user clicks on the ball, it falls down and roll around.

The problem is when i use unpin to unpin the ball from the background sprite it also unpin the shadow from the ball... i wish i could unpin the ball from the background sprite, but not the shadow from the ball.

Is there a way to do that?

Thanks!
B
14
S
5
Posts: 110
Reputation: 1,338

Post » Sun Oct 16, 2016 4:14 pm

artbava wrote:The problem is when i use unpin to unpin the ball from the background sprite it also unpin the shadow from the ball... i wish i could unpin the ball from the background sprite, but not the shadow from the ball.


The problem is that when you run the event, it will run the event for every instance of the object the fits the condition. It will do this unless you tell it to do otherwise.

Every individual object has a unique UID. If you click on the ball and find out what it's UID is, you can choose which specific instance of an object you want to unpin. Just go to the conditions list and add the condition that says pick by unique id.

There is also the possibility of adding a second object that is the shadow and pinning it to the ball. That way you can unpin the ball without unpinning the shadow.

There is also a third possibility, and undoubtedly the best solution, is to not make a specific object to be the ball at all and just create a Shadow Light. Add the shadow caster behavior to the ball and you have a shadow. Just remember that shadow is on the same layer as the light, so putting the light on the highest layer puts the shadow above everything, while putting it on the lowest layer puts it below everything.
B
8
S
2
Posts: 20
Reputation: 599

Post » Sun Oct 16, 2016 8:00 pm

Unpin, and directly re-pin those you need again. You can not unpin from any selected/not selected object.

But. A falling ball sounds as physics to me. Then at least one pin is not needed, well not wanted even.

https://www.dropbox.com/s/6m8wxbm0x9y47 ... .capx?dl=0

Shadow is in a container with a ball.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Oct 17, 2016 2:46 pm

99instances2Go - really thank you for the capx and ideas, i appreciated and learned new things! Your solution, i think, is the most affordable one in my game's scenario.

DerpyDev - i also appreciated you suggestions, Didn't tried it yet, but i will. Wonder why we can't specify the object to unpin, as we can do with the pin behavior.

Best regards!
B
14
S
5
Posts: 110
Reputation: 1,338


Return to How do I....?

Who is online

Users browsing this forum: Diamond Dino 64 and 3 guests