0 Favourites

Help with Pin Logic

  • 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?

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • just use a second condition for the helicopter

    Helicopter Is overlapping Cargo

    X(inverted) Helicopter Is overlapping Missile: Pin Pin to Helicopter

  • 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?

  • Use set position to another object > Object/Image point

  • set the position before you pin

  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)