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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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