Jump to content

Advice for creating dynamic path based motion


Guillaume
 Share

Recommended Posts

Hi everyone,

 

As the title says I need some advice on how to create dynamic motion. Actually I'd like to create something like this game : http://jointhepod.org/assets/games/AtoB/index.html

 

I already have a system that draw a doted line based on the user input :

When the mouse is pressed, I record and store all mouse position if the distance with the previous point if greater than K pixels. 

 

When the mouse is released I want my character to follow the path the user just drew. I actually to :

var t = game.add.tween(mainChar);for(var i=0; i<points.length;i++){   t.to(points[i], 120, Phaser.Easing.Linear.None);}t.start();

Where points is an array of Point objects.

 

The problem is the motion of the sprite is not smooth, quite obvious since I chained the tweens, and I 'm wondering if there is / are clever way(s) to achieve the expected result.

 

Thx,

G. 

 

Link to comment
Share on other sites

  • 4 weeks later...
 Share

  • Recently Browsing   0 members

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