Pin on collision

  • Hi all,

    Loving Construct 2 so far.

    What I want to do:

    When apple collides with bubble -> pin apple to bubble

    This works perfectly for one instance of an apple and bubble. When I have multiple apples/bubbles however, all the apples pin to a single bubble.

    Any help would be greatly appreciated.

  • Could you provide more details or capx file? What other behaviors apple or bubble has?

  • A bit of a dirty trick which may or may not work would be to add a local/instanced variable to each apple "collided=0" and then have a collision change that value to 1 and make that trigger a pin command? I'm fairly new to construct so don't waste too much time on it if it doesn't work.

    There probably is a more elegant solution out there though.

    Alternatively you could make a new object spawn which is both bubble and apple together. Maybe.

    -EDIT-

    Ignore mine, the instance solution below is much better.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're luck today ^^

    It's a tutorial to help you understand how instances works.

    scirra.com/tutorials/361/understanding-uid-iid-health-of-enemies-and-rocket-smoke-trail

    I would recommend you to make a "instance variable" called "ID" for each bubble and each apple and make the condition to meet for the apple colliding with the bubble, check their ID and setup to pin the apple ID "x" to the bubble collided bubble with ID "y"

    I'm sorry to don't create a CAPX for you, also, hopping this explain help in anything.

  • apple: on collision with bubble

         apple: pin to bubble

    should work with multiple apples/bubbles.

  • apple: on collision with bubble

         apple: pin to bubble

    should work with multiple apples/bubbles.

    Sometimes We complicated what is simple ^^

    How it work with concurrence when hitting, or, for a single apple don't pin in multiple bubble you still needing to make a variable Boolean too, call it as "already pinned" and set ON when the apple pin to the bubble.

  • Thanks so much for the replies guys, that tutorial link is especially useful.

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