[Behavior] SplinePath

Forum Home Forum Home > Construct 2 Development > Plugins for Construct 2
 Post Reply Post Reply Page  123>
Author
5,295 Rep
Post Options Post Options   Quote Pode Quote  Post ReplyReply Direct Link To This Post Topic: [Behavior] SplinePath
    Posted: 07 Mar 2012 at 6:08pm
It's a behavior which was getting dusty on my hard drive, so I cleaned it a bit, and I'm posting it here.

The idea is to set Spline Path for Sprite, making them moves along a spline with a smooth path.



The spline code is adapted from here : https://github.com/MmmCurry/jquery.crSpline. Instead of setting the (X,Y) position via CSS and jQuery.fx, I'm directly accessing the (X,Y) position of the Sprite.

The spline used is Catmull-Rom, allowing the trajectory to go through the points, instead of Bezier, where the control points and the trajectory points are different.

The demo : http://dl.dropbox.com/u/1412774/SplinePathBehavior/index.html
The capx : http://dl.dropbox.com/u/1412774/SplinePathBehavior/splinepathbehaviordemo.capx
The plugin : http://dl.dropbox.com/u/1412774/SplinePathBehavior/pode_splinepath.0.1.zip

Edit : the demo uses R0j0hound's Canvas, for the trail.

Edited by Pode - 07 Mar 2012 at 6:11pm
Back to Top
16,358 Rep
Post Options Post Options   Quote newt Quote  Post ReplyReply Direct Link To This Post Posted: 07 Mar 2012 at 6:48pm
Thanks again!
Any plans for stuff like speed, and resetting points?
Back to Top
5,295 Rep
Post Options Post Options   Quote Pode Quote  Post ReplyReply Direct Link To This Post Posted: 07 Mar 2012 at 6:56pm
@newt : yes, I'm planning to add speed (allowing you to choose how much time between two points), and resetting the behavior.
Back to Top
6,876 Rep
Post Options Post Options   Quote tonycrew Quote  Post ReplyReply Direct Link To This Post Posted: 07 Mar 2012 at 7:52pm
Thanks i haven't had time to use this yet due to redoing my PC, but is there a At End of Path feature, say Reverse, or Jump to Beggining...?
If not this would be great for Patroling Enemies.

Edited by tonycrew - 07 Mar 2012 at 7:54pm
http://dl.dropbox.com/u/44766364/Games/Space2011/index.html Space 2011 (C2 Competition Entry
http://dl.dropbox.com/u/44766364/Games/getin/index.html Get That Ball In (C2 Game)
Back to Top
5,295 Rep
Post Options Post Options   Quote Pode Quote  Post ReplyReply Direct Link To This Post Posted: 07 Mar 2012 at 8:10pm
@tonycrew : for the moment, you need to do that manually, by adding points for the "go-back" path, but thanks for the suggestion, I'm going to add it.
Back to Top
6,876 Rep
Post Options Post Options   Quote tonycrew Quote  Post ReplyReply Direct Link To This Post Posted: 07 Mar 2012 at 8:12pm
Thanks that will be great and save alot of time....
http://dl.dropbox.com/u/44766364/Games/Space2011/index.html Space 2011 (C2 Competition Entry
http://dl.dropbox.com/u/44766364/Games/getin/index.html Get That Ball In (C2 Game)
Back to Top
9,136 Rep
Post Options Post Options   Quote edisone Quote  Post ReplyReply Direct Link To This Post Posted: 07 Mar 2012 at 8:39pm
very useful...tnx a lot Pode
Back to Top
922 Rep
Post Options Post Options   Quote unlikely Quote  Post ReplyReply Direct Link To This Post Posted: 07 Mar 2012 at 10:33pm
Haha awesome, I was about halfway through creating my own path system! Now I can focus on the actual game creation. Thanks!
Back to Top
1,008 Rep
Post Options Post Options   Quote Cassianno Quote  Post ReplyReply Direct Link To This Post Posted: 07 Mar 2012 at 10:49pm
BOSSY plugin for tower defense games.

Thanks Pode!
Back to Top
10,250 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 07 Mar 2012 at 11:53pm
Cool~ Can I use the algorithm of spline path in my step behavior?

Edited by rexrainbow - 07 Mar 2012 at 11:54pm
Back to Top
 Post Reply Post Reply Page  123>

Forum Jump Forum Permissions View Drop Down