help with trigonometry

Get help using Construct 2

» 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?

Thanks!
B
3
Posts: 3
Reputation: 531

» 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

» 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

» 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

Please attach a capx to any help request or bug report !
Moderator
B
243
S
85
G
39
Posts: 6,930
Reputation: 56,894

» Sun Aug 19, 2012 12:03 pm

B
160
S
48
G
79
Posts: 7,228
Reputation: 60,984

» Sun Aug 19, 2012 12:32 pm

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

» Sun Aug 19, 2012 12:49 pm

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

» 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

» 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

Who is online

Users browsing this forum: chaoyue123, erickson400, Exabot [Bot], miketolsa, RoboFrosty and 12 guests