Mouse tracking within limits

Get help using Construct 2

Post » Wed Aug 14, 2013 4:25 am

Hello everyone.

I'm trying to make a game where you control the body of a dragon with WASD keys and her head tracking the mouse movements.

But I'm stuck trying to make the head moving only inside a circular area around the body (neck limit).

I found this tutorial:

http://www.scirra.com/tutorials/127/mousemoves-1-to-1-movement]this tutorial

which speaks about conditional mouse tracking in its last paragraphs but I don't figure how to apply it to my problem.

Thank you in advance and sorry for my poor English.Clara2G2013-08-14 04:28:21
B
3
Posts: 2
Reputation: 244

Post » Wed Aug 14, 2013 6:33 am

I think what you are looking for is a "distance" expression restriction to the Head motions from the Neck or body of the dragon
You could try adding an extra Condition to your Mouse events

Use something like this


Mouse(distance dragonheadx, dragon heady, mousex, mousey,)
less than or equal to (the distance you want to restrict the movement to)

then your usual events and actions
another way is to "Physics Joint" everything in the Dragon head and neck.. and use a constant physics force that pushes the Dragon head towards the mouse POS but is restrained by the joint force...its a fine balance but it can work good

Obviously alot of experimentation is required.

Did that make sense?
Ive used this technique in another game and it works fine...
Just play around with the factors..

When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Post » Wed Aug 14, 2013 8:06 am

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 » Wed Aug 14, 2013 4:25 pm

Thank you guys!

mystazsea, sure it makes sense! You've helped me to understand better how this works

LittleStain, that's exactly what I want! Did you make it just for showing me? That's so kind.

Thank you both.Clara2G2013-08-14 16:27:39
B
3
Posts: 2
Reputation: 244


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest