Unpin without behavior

0 favourites
  • 8 posts
  • Hi,

    I'm trying to figure out a way to have an object "grab" another object in mid-air, carry it for x amount of seconds and release it at an upward angle, continuing the original trajectory.

    Here's the premise: The player is shot out of a cannon (using bullet behavior). If he collides with a flying object , the bullet behavior becomes inactive for 3 seconds while the object carries the player on a straight trajectory. After the 3 seconds are up, the player gets released at an upwards angle.

    The flying object is moving with a bullet behavior as well.

    I'd like to set an action where the player has an image point on his back, and the flying object has another image point at its "feet", so when the overlap happens, the player seems to be carried by his back.

    I've tried using the pin/unpin behavior on the player, but the issue is that it pins at either angle/rotation or both (rope or bar don't work for this). I know that move to position at every tick can be used to replace the Pin behavior. I'm not sure how to Unpin it though.

    Makes sense?


  • Well, the pin behaviour is the best bet for this purpose, but you first need to set its position, then pin it (both in the event sheet), for best results (in this case, at least). Unpinning can be done in the event sheet as well.

    Your other option, which is functionally the same as using the pin behaviour, is to set position to another object each tick, specifying the desired image point. This way you can specify another condition, maybe a timer, and when that other condition is no longer met, the child object will simply cease to be "carried".

    Here's a quick example (r134). Drag the green block onto the pink one.

  • Thank you very much GeometriX!

    Your example worked. The main issue I'm getting now is that regardless of the "carrier" objects in the screen (they're all copies of the first one), the player always sets position to the first one - as shown in the image below.

    I'm assuming it has to do with UID's, but I'm not sure how to specify the Set Position to the the colliding carrier.

    The interesting thing is that the colliding carrier gets the bullet effects set in the events.

    <img src="http://i.imgur.com/OFr83Hj.png" border="0" />


  • You need to store the UID of the carrier so you can Pick it again later to do your positioning.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How do you do that?

    Sorry if it's a basic question. I know it's possible to do that with an array or a loop, but not with pre-existing copies (at least not that I found).

  • Add a variable instance to the player, and when the player gets grabbed, go "set player.variable = carrierobject.uid"

    That way, you just add "if carrierobject.uid = player.variable" to the conditions and it will pick the carrierobject your player got grabbed by.

  • Brilliant!

    Thank you very much blackhornet for the example.

    And thank you all for clarifying the process.

    Clarity is in sight (yes, pun intended)

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