help with trigonometry

Get help using Construct 2

Post » Sun Aug 19, 2012 8:45 am

Hi Guys,

Not too hot on trigonometry wondered if someone could help?



My object is the green arrow (it's facing right)
How do I detect when the mouse cursor is the darker part of the circle?

Any advice, guidance or links is appreciated!

Thanks!
B
3
Posts: 3
Reputation: 531

Post » Sun Aug 19, 2012 10:39 am

The great thing about C2 is that it does all the trigonometry for you.
My approach would be:

Demo

capx
B
79
S
32
G
23
Posts: 119
Reputation: 14,937

Post » Sun Aug 19, 2012 11:41 am

Hi Kastas

Thanks for the quick reply but I'm afraid you've taken my question too literally. Yes, that works, but in reality the circle doesn't exist.

I really do need the trigonometry...

B
3
Posts: 3
Reputation: 531

Post » Sun Aug 19, 2012 11:56 am

The circle is an illusion Neo.

Or perhaps you should explain in more details what you're wanting to do, expecting to do with such a detection and so we could provide more efficient help.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Sun Aug 19, 2012 12:03 pm

Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sun Aug 19, 2012 12:32 pm

Couldnt between x y do the trick without the circle?
B
5
Posts: 10
Reputation: 572

Post » Sun Aug 19, 2012 12:49 pm

Newt, great thank you! That does the job nicely :)
B
3
Posts: 3
Reputation: 531

Post » Sun Aug 19, 2012 3:49 pm

[QUOTE=newt] Again, C2 does the math for you.

https://dl.dropbox.com/u/666516/moveatmouseangle.capx[/QUOTE]

C2 and @newt at their best. Crazy simple. I feel like an ...
B
79
S
32
G
23
Posts: 119
Reputation: 14,937

Post » Sun Aug 19, 2012 5:55 pm

My turret behavior has exactly that. If you don't mind using third party plugins, it can be a great way to achieve that without thinking too much or complicating your code, and it can be added to multiple instances.

check it out
B
35
S
8
G
8
Posts: 532
Reputation: 6,868


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 30 guests