[SOLVED]Move around point in circles

Get help using Construct 2

Post » Fri Jan 11, 2013 12:47 am

My project had some particular movement, the player moves forward (with W or back with S) to a point given by mouse (that's done) . Then, the movement to left and right is around it, without change the distance (unless we use the W and S, of course), in few words, the player moves in a circle around the mouse cursor. There is some function of archive this or I must use maths ?

Here a diagram:   

http://s7.postimage.org/v15cnej23/idea_001_zpsd397be6b.gifgabrign2013-01-11 18:20:48
B
11
S
2
Posts: 21
Reputation: 1,171

Post » Fri Jan 11, 2013 2:55 am

Nice animation describing your problem. It's too fast though. All my tipsy mind can see are sexual innuendos ;)

Yes you'll need math to do this (unless there's an orbit plugin for C2). I know how to do it, but my mind has shut down for the night to anything math related. If no one else has solved it, I'll have a bash tomorrow.
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Fri Jan 11, 2013 6:43 am

Thanks for reply! Hehehe I put a bad delay for the frames in the gif :P

I had the formula just there for use it, I think must be something like this (I just wake up in this moment, I don't test it):

player.Y:
mouse.Y + int(Round( distance (mouse.X,mouse.Y,player.X,player.Y)* Sin( player.angle ) ));
player.X:
mouse.X + int(Round( distance (mouse.X,mouse.Y,player.X,player.Y) * Cos( player.angle ) ));

I will confirm if this works here :D
B
11
S
2
Posts: 21
Reputation: 1,171

Post » Fri Jan 11, 2013 10:54 am

I think you may be overcomplicating things.

I made an example .capx here, hopefully this helps: https://www.dropbox.com/s/aasfohmj363gm1z/rotatecontroller.capx
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Fri Jan 11, 2013 6:10 pm

I finished the test using the maths but yours is so simply, elegant...! I didn't take a look to the angle movement actions until now For that I was using bullet for movement. Anyway if somebody wish take a look making it in the really noob way :

http://dl.dropbox.com/u/47230303/rotation_combat_test.capx

Thanks you very much!

PD: The movement of the object in your example appears increase his radius in the movement left/right. Can it be some estrange angle conversion from SC2 ? Anyway, is so perfect at is!
B
11
S
2
Posts: 21
Reputation: 1,171

Post » Tue Jun 18, 2013 8:59 am

Thank you, it can make my game better
B
4
Posts: 16
Reputation: 864


Return to How do I....?

Who is online

Users browsing this forum: ETgirl79 and 15 guests