Help with Pin Logic

Get help using Construct 2

Post » Sun Nov 24, 2013 1:25 am

I'm having a problem with my pinned sprites. I would like to make a game about a helicopter carrying cargo underneath it. When the helicopter gets hit buy missile, it drops the cargo, but if the player is quick enough, there is a chance the cargo can be recovered before smashing into the ground. This is what I have for this:


System > On start of layout > Cargo > Pin Pin to Helicopter

Missile > Is overlapping Helicopter > Unpin Cargo

Helicopter > Is overlapping Cargo > Pin Pin to Helicopter


The last 2 events conflict. Nothing happens. I'm not sure how to tell C2 to wait until the objects are no longer overlapping before checking if they are overlapping again before then pinning the cargo back to the helicopter.

Can anyone help with this?
B
14
S
3
G
1
Posts: 87
Reputation: 1,108

Post » Sun Nov 24, 2013 1:30 am

Set a boolean variable e.g.'MissileHit' for the helicopter. Set it to true when the helicopter is hit by the missile then set it to false 1 second(or so) later. Then set up a condition for the last event Helicopter is overlapping cargo AND MissileHit = false > pin to heli.plinkie2013-11-24 01:33:09
B
47
S
18
G
84
Posts: 2,270
Reputation: 49,794

Post » Sun Nov 24, 2013 2:47 am

just use a second condition for the helicopter

Helicopter Is overlapping Cargo
X(inverted) Helicopter Is overlapping Missile: Pin Pin to Helicopter mindfaQ2013-11-24 02:47:47
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Sun Nov 24, 2013 3:08 am

Ah! It works like a switch. Thank you, Plinkie.

And thanks, mindfaQ. I'll try your method once I get further along. It's working, so I don't want to mess with it.


I have one more problem. If the player is too quick, the cargo pins itself whatever part of the helicopter is touches first. Anyway I can get it to attach to the same place under the helicopter? Maybe to the image point?

I tried:

Setting the cargo position to helicopter.ImagePointY(0) and helicopter.ImagePointX(0)

I thought that would attach it directly on the image point set for the helicopter, but it didn't work. Any ideas?
B
14
S
3
G
1
Posts: 87
Reputation: 1,108

Post » Sun Nov 24, 2013 3:41 am

Use set position to another object > Object/Image point
B
47
S
18
G
84
Posts: 2,270
Reputation: 49,794

Post » Sun Nov 24, 2013 4:26 am

set the position before you pin
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Thu Nov 28, 2013 4:11 am

Sorry for the late reply. I became busy and spaced this thread off. Before I forget again, thank you both for all your help. I really appreciate it!
B
14
S
3
G
1
Posts: 87
Reputation: 1,108


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests