[Solved] Floating Pin Behavior

0 favourites
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • I have an object slowly falling from the top of the game screen. Think a ball with a balloon attached. The player must grab other balloons that are floating upwards and drag them onto the falling object.

    This is all working well. The player drags the balloon onto the falling object and the balloon snaps to the center of the falling object. Great!

    <strike>The issue is, the balloon then starts floating away again (as it should), but I want to "tie" that balloon to the falling object, so it doesn't float away.</strike>

    EDIT: Thanks to c4sp3r89, I have used the Pin behavior to get tie the balloon to the falling object.

    However, the player can 'tie' multiple balloons to the falling object, and once pinned, the balloons no longer act like balloons should.

    How would I accomplish this? It's driving me crazy.

  • Pin the balloon to the falling object using the pin behaviour?


  • Wow... I can't believe I missed that one! Thanks a ton for pointing it out to me. I guess I need to read that manual some more :D

    The problem now is that they do indeed pin to the falling object, but not as expected. Using any method (Rope sounds ideal) still makes the balloons pop to the center of the object and stick. I need them to be well... roped :D

    Any ideas why this isn't behaving as expected? The balloons only have the pin, sine, and bullet behaviors, so I'm not sure if any of that is conflicting or not.

  • I believe what you want is that although the balloon is pin to the object, the balloon will still be swaying instead of being static am I right?

    As long as you use pin behaviour, it will stop all the additional movement you have for the object as it will be following the pinned object.

    Maybe you can do the balloon swaying effect as an animation?

  • Hmmm... Yes, but animating them will not work because the player may have to attach many of them to the falling object depending on it's weight. So each balloon has to kind of "find it's own space" if that makes any sense.


    For kicks, I attached the physics behavior to the balloons, and now the movement isn't negated when using the Pin behavior. They are not really behaving like a bunch of balloons should though. :(

  • EDIT: updated topic

  • just brainstorming:

    I would probably create a "rope" when the balloon is close enough and on mouse button released create revolute joints at both ends of the "rope".

  • just brainstorming:

    I would probably create a "rope" when the balloon is close enough and on mouse button released create revolute joints at both ends of the "rope".

    That's exactly what I wanted to do in the first place! I tried this (you'll see parts of that design in the capx file), and spent a good day trying to get it to work. Both on start of layout and at the point the balloons spawn I tried:

    Balloons Create Physics revolute joint at image point 0 to stringStart


    stringStart Create Physics revolute joint at image point 0 to Balloons

    I believe the first is correct, but neither seemed to have any effect. I can only guess because I'm trying to use physics on a bullet behavior.

  • Fron the top of my head (could have some flaws):

    To create the "rope" use a sprite, make an extra imagepoint on the left and one on the right.

    Set the "rope" position to x=lerp(balloon.x,object.x,0.5) y=lerp(ballon.y,object.y,0.5)

    Set it's width to distance(balloon.x,balloon.y,object.x,object.y) and it's height to what's desired.

    on mouse released:

    Pin the balloon to "rope" imagepoint(2)

    pin the object to "rope"imagepoint (1)

    (choose only position for the pinning, and probably rope style.)

    this way you don't need physics

    The same can be done with physics, but then you should abandon bullet behaviour and use physics for everything.

  • It probably would be best to put balloon and rope in a container.

    and set the rope to invisible at start and visible when the distance is less then a certain amount.

    only create the pin if the rope is visible.

  • Ok these are awesome suggestions. Let me tinker with this and see what I can come up with. Thanks! I'll report back with some progress soon.

  • Alright I have updated the capx with my latest progress. I tried doing the rope in the method suggested, but I couldn't wrap my head around it. The results were awful :D

    Using containers and joints I was able to get the string to attach to the balloon, but it still will not attach to the falling object using joints. I have to pin it.

    My thinking is that once the balloon and string (which are jointed) is dragged on top of the falling sprite, I *should* be able to joint the string to the falling object and it will tether it.

    This is still not happening.

    Also.... all of the balloons are now "resisting" touch/mouse like they don't want to be clicked. No idea why this is happening... grrr.

  • You will have to choose for either physics or other behaviours. Working together with other behaviours physics gives unexpected and often unwanted results.

    I can't make a working example of my explanation right now, so I can't be sure what I imagined can be done.

  • I tried placing only physics behavior on the objects, but I'm not sure how to simulate that gravity/float effect.

    Place velocity and force didn't seem to move them, nor did setting world gravity. How would I achieve those effects using only the physics behavior?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Didn't get the effect completely right,but At least I tried

    When attaching balloons the gravity-effect on the animalballoon will change.. Needa a lot of tweaking though..

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