make gun barrel follow pointer

Get help using Construct 2

Post » Sat Mar 08, 2014 10:50 pm

Message: hopr37 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
I have a pointer that has drag drop associated with it.
While moving it around, I wish to have my barrel follow the pointer.

I've tried pin action but that doesn't work.
any suggestions?

ugly graphic of what I mean

https://db.tt/rMdzGsfP
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Sat Mar 08, 2014 11:07 pm

use the action "set angle toward position" on your gun and set it to x = point.x, y = point.y
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Sat Mar 08, 2014 11:10 pm

perfect. thanks
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Sun Mar 09, 2014 12:57 am

didn't work :(
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Sun Mar 09, 2014 1:31 am

@hopr37 Just create a System event with Every Tick condition then follow the provided step by @cvp
B
13
S
4
G
4
Posts: 42
Reputation: 3,962

Post » Sun Mar 09, 2014 1:39 am

I did that . and used every tick. But the gun flips around and doesn't stay positioned.
I tried anchor but that didn't help.
It's the right idea but I'm getting something wrong.
I need to keep the gun positioned at a fixed point and when I move the pointer, the gun follows the pointer but stays at a fixed location.
I've moved my image point but still no go.
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Sun Mar 09, 2014 1:57 am

While clicked, set the barrel angle to "angle(barrel.x,barrel.y,mouse.x,mouse.y)".
B
123
S
43
G
41
Posts: 846
Reputation: 28,204

Post » Sun Mar 09, 2014 7:36 pm

supply your capx if possible. The steps we have provided should do what you ask.

Then we can debug it and see what the problem is.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Sun Mar 09, 2014 7:41 pm

sorry CVP. Should have said that I have gotten it to work. My bad. Thanks for the interest tho.
B
7
S
2
Posts: 158
Reputation: 1,021


Return to How do I....?

Who is online

Users browsing this forum: fens, plinkie and 18 guests