[SOLVED]Move around point in circles

0 favourites
  • 6 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • 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:   


  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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):


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


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

    I will confirm if this works here :D

  • I think you may be overcomplicating things.

    I made an example .capx here, hopefully this helps: https://www.dropbox.com/s/aasfohmj363gm1z/rotatecontroller.capx

  • 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 <img src="smileys/smiley17.gif" border="0" align="middle" /> For that I was using bullet for movement. Anyway if somebody wish take a look making it in the really noob way <img src="smileys/smiley2.gif" border="0" align="middle" />:


    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! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Thank you, it can make my game better

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)