[Solved] Floating Pin Behavior

Get help using Construct 2

Post » Thu Sep 12, 2013 2:40 am

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!

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.

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. GrimPanda2013-09-12 17:17:37
B
13
S
3
G
2
Posts: 11
Reputation: 1,361

Post » Thu Sep 12, 2013 4:07 am

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

https://www.scirra.com/manual/99/pin
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Thu Sep 12, 2013 5:03 am

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.
B
13
S
3
G
2
Posts: 11
Reputation: 1,361

Post » Thu Sep 12, 2013 5:19 am

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?
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Thu Sep 12, 2013 5:34 am

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.

EDIT:
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. :(

GrimPanda2013-09-12 05:37:01
B
13
S
3
G
2
Posts: 11
Reputation: 1,361

Post » Thu Sep 12, 2013 5:43 am

EDIT: updated topicGrimPanda2013-09-12 17:18:14
B
13
S
3
G
2
Posts: 11
Reputation: 1,361

Post » Thu Sep 12, 2013 1:27 pm

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".
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Sep 12, 2013 1:37 pm

[QUOTE=LittleStain] 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". [/QUOTE]

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.
B
13
S
3
G
2
Posts: 11
Reputation: 1,361

Post » Thu Sep 12, 2013 1:59 pm

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.LittleStain2013-09-12 14:00:40
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Sep 12, 2013 2:02 pm

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: Fradno, odiusfly and 24 guests