How do I create a ragdoll in specific place?

Get help using Construct 2

Post » Wed Jun 21, 2017 4:58 am

Hello, guys, I'm trying to create and position a ragdoll in the specific place of my game layout. In this simple experiment I used tutorials 'Rag doll example' and added two new actions - put invisible 'target' sprite to the mouse pointer and set ragdoll body position to it.

As a result, ragdoll flies away and never comes back, instead of 'hanging' from the mouse pointer and then falling down. What's wrong?

Image
B
16
S
5
G
1
Posts: 23
Reputation: 1,557

Post » Wed Jun 21, 2017 8:32 am

@ankas

There are a couple of things going on here:

1) When the project starts, sometimes mouse x,y will be registered as 0,0 (I think this is when the mouse is out of window at the start). Even if it isn't there is likely to be a displacement between mouse x,y and body x,y.

2) All those limb objects have the physics behaviour on them, so when Body is moved in the start of layout event they all suddenly get an impulse applied, which immediately propels them towards the target. This impulse continues in subsequent frames, shooting the whole ragdoll off the screen. Try disabling all of the "Create Physics revolute joint" actions at the start and you will see that the impulse is eliminated.

The easiest way to fix this would be to shift the "target|Set position" and "body|Set position" actions above the "Create Physics..." actions and to swap the mouse co-ordinates for a fixed screen position.
B
19
S
8
G
3
Posts: 425
Reputation: 3,968

Post » Wed Jun 21, 2017 6:21 pm

@mekonbekon


Thank you, it works, not very well though.... What I did:
1. Position body to 'player' visible sprite.
2. Position head, arms, and legs to body.
3. Enable physics.
4. Make joints.
5. Apply torque to the body in the angle of 'player' movements. It seems it does not work.

Can you take a look at my capx, please?

https://www.dropbox.com/s/7guft5u0nvshm ... .capx?dl=0
B
16
S
5
G
1
Posts: 23
Reputation: 1,557

Post » Wed Jun 21, 2017 7:38 pm

Here you go:

https://www.dropbox.com/s/slm6gai7z026l ... .capx?dl=0

I had to fiddle around with the origins on the limbs to get them into place
B
19
S
8
G
3
Posts: 425
Reputation: 3,968

Post » Wed Jun 21, 2017 8:09 pm

Thank you! It works!
B
16
S
5
G
1
Posts: 23
Reputation: 1,557

Post » Thu Jun 22, 2017 9:31 am

Cool! Glad to help out :)
B
19
S
8
G
3
Posts: 425
Reputation: 3,968

Post » Fri Jun 23, 2017 12:10 am

@mekonbekon


Thank you for your help, but now I experienced another problem. And the problem is how to enable my ragdoll.

With a 'mouse click' it works just fine, but when I use 'hitpoint=<0' or 'alive=0' (variables) conditions, the positioning continues to work every tick, as variable is not changing anymore. Thus the 'body' of the ragdoll is hinged to specific point, rotating as crazy.

Any idea how to fix this issue and what is the best way to enable ragdoll?
B
16
S
5
G
1
Posts: 23
Reputation: 1,557

Post » Fri Jun 23, 2017 9:18 am

@ankas I'm not quite sure what you mean - could you post a capx?
B
19
S
8
G
3
Posts: 425
Reputation: 3,968

Post » Fri Jun 23, 2017 5:51 pm

@mekonbekon


Sorry for the delay with the response, probably we are in very different time zones.

I added a variable 'hitpoint' which can be reduced, using double-click. When it reaches '0', I want to replace my sprite animation (not implemented yet) with a ragdoll, positioned on invisible 'player' sprite (I made it visible for better control and understanding of what is going on).

Thanks for your time.

https://www.dropbox.com/s/7guft5u0nvshm ... .capx?dl=0
B
16
S
5
G
1
Posts: 23
Reputation: 1,557

Post » Fri Jun 23, 2017 7:14 pm

@ankas

The points check is firing every tick, which is messing things up for you. I think this should work ok:

Image
B
19
S
8
G
3
Posts: 425
Reputation: 3,968

Next

Return to How do I....?

Who is online

Users browsing this forum: plinkie and 32 guests