Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

help needed for simulating a movement of a character along a curved line


pinastroHTML5
 Share

Recommended Posts

Hi all,

 

  Please find the following link 

http://collegetomato.com/forDhruva/nanoSWAT/curveMovement/

 

which I have done using construct2 game engine and it took me almost a week to do this. Considering my programming skill of a designer(who also codes sometimes) it would take more time in Phaser.

 

Can you help me out with a code snippet which simulates the action shown in the link

 

 

The algorithm I have used is ... I am storing the trails as the player is touching the screen and storing the X,Y, direction (relation between previous consecutive trails) in an array which I am looping through and then changing the Y position of the main Sprite when the X of the next trail is less than the main sprite. ..if the current direction is LEFT to RIGHT.similarly changing the Y position of the main sprite if the X of next trail is greater than the main sprite ..if the current direction is RIGHT to LEFT

 

sorry if the explanation for the algo is crude :)

 

thanks

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...