[Behavior] SplinePath

Post your completed addons to share with the community

Post » Wed Mar 07, 2012 6:08 pm

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.Pode2012-03-07 18:11:18
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Mar 07, 2012 6:48 pm

Thanks again!
Any plans for stuff like speed, and resetting points?
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Wed Mar 07, 2012 6:56 pm

@newt : yes, I'm planning to add speed (allowing you to choose how much time between two points), and resetting the behavior.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Mar 07, 2012 7:52 pm

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.tonycrew2012-03-07 19:54:47
B
40
S
14
G
11
Posts: 243
Reputation: 9,427

Post » Wed Mar 07, 2012 8:10 pm

@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.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Mar 07, 2012 8:12 pm

Thanks that will be great and save alot of time....
B
40
S
14
G
11
Posts: 243
Reputation: 9,427

Post » Wed Mar 07, 2012 8:39 pm

very useful...tnx a lot Pode
B
159
S
38
G
11
Posts: 229
Reputation: 17,361

Post » Wed Mar 07, 2012 10:33 pm

Haha awesome, I was about halfway through creating my own path system! Now I can focus on the actual game creation. Thanks!
B
13
S
6
G
2
Posts: 13
Reputation: 1,977

Post » Wed Mar 07, 2012 10:49 pm

BOSSY plugin for tower defense games.

Thanks Pode!
English is not my native language. Sorry for any mistakes and feel free to correct me if needed.
B
14
S
5
G
3
Posts: 110
Reputation: 3,225

Post » Wed Mar 07, 2012 11:53 pm

Cool~ Can I use the algorithm of spline path in my step behavior?rexrainbow2012-03-07 23:54:27
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 3 guests