[Behavior] Swing

Post your completed addons to share with the community

Post » Thu Nov 10, 2011 9:31 am

Swing
(Update: 2013/05/18)

Swing behavior rotates sprite from "Start angle" to "Start angle + Rotate Angle", then rotates back to "Start angle" repeatedly.


image created by gonzdevour

Rotate Angle > 0: clockwise
Rotate Angle < 0: anti-clockwiserexrainbow2013-05-18 04:40:25
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Thu Nov 10, 2011 10:19 am

Doesn't the sine behavior do this already?
Good idea, but what improvements does it offer over sine?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Thu Nov 10, 2011 10:26 am

When you need a constant rotate speed. Sorry I miss this, acc =0 and dec = 0 means using max speed.

Sin @angle mode:
initialValue + Math.sin(dt) * magnitude

The calculation of angle is different. (Btw, the target rotation angle may a little implicit in sine behavior)

Ah, I forgot these. Swing behavior provide some conditions
- "On hit start angle",
- "On hit end angle",
- "On hit start or end angle"



--

Actually, it is similar with "MoveTo" behavior -- speed up(if acc>0), hold on max speed(if still have time), slow down(dec >0).
I made "Swing" first, then "MoveTo".rexrainbow2011-11-10 10:44:44
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Sun Nov 13, 2011 3:30 pm

very nice job as ever,tnx Rex
B
159
S
38
G
11
Posts: 229
Reputation: 17,361

Post » Fri Mar 23, 2012 3:18 pm

Update:

Add version to 1.0
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Tue Jun 12, 2012 6:08 pm

Thank you Rex, with this I can make swinging obstacles for my platform game :D
B
28
S
5
G
5
Posts: 30
Reputation: 5,836

Post » Thu Jun 14, 2012 1:00 pm

Nice!!!
B
21
S
1
Posts: 7
Reputation: 1,547

Post » Sat May 18, 2013 4:40 am

Update

Support official save/load.
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Fri Dec 12, 2014 8:21 pm

404
Image
B
54
S
22
G
7
Posts: 1,405
Reputation: 10,289

Post » Fri Dec 12, 2014 8:47 pm

korbaach wrote:404

https://dl.dropboxusercontent.com/u/577 ... x_swing.7z

This behavior had not been maintained. Use tween behavior for instead.
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 0 guests