Soft Rotation

For questions about using Classic.

Post » Sun May 03, 2009 3:39 pm

1) Does anyone know how to set an object's angle to a certain degree gradually only with help of "Set Angle" action but no behaviours?
2) Does anyone know how to make an object deccelerate rotation gradually if no key is pressed (with help of "Rotate" behaviour)?
B
78
S
23
G
6
Posts: 234
Reputation: 7,662

Post » Sun May 03, 2009 5:56 pm

[quote="Android-Music":1h7czqov]1) Does anyone know how to set an object's angle to a certain degree only with help of "Set Angle" action but no behaviours?[/quote:1h7czqov]
set angle does set the angle to a certain degree, you just type in the angle you want and it sets it there
[quote:1h7czqov]2) Does anyone know how to make an object deccelerate rotation if no key is pressed (with help of "Rotate" behaviour)?[/quote:1h7czqov]
use the mouse keyboard object
click here
I don't think there is a any key is down condition, or a way to fake one easily, but this works well enough for the specific keys that you want
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun May 03, 2009 6:13 pm

Sorry man, forgot to add "gradually". Edited first post.
B
78
S
23
G
6
Posts: 234
Reputation: 7,662

Post » Sun May 03, 2009 6:31 pm

for 45 degrees for instance

if angle is less than 45
rotate clockwise 1

it's better if you have a position
then you can do rotate toward position
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun May 03, 2009 8:03 pm

Thanks, but that's not a solution. I think Timedelta can help somehow, but how...
B
78
S
23
G
6
Posts: 234
Reputation: 7,662

Post » Sun May 03, 2009 8:47 pm

"Rotate 360*TimeDelta degrees" will make a sprite rotate once per second.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun May 03, 2009 8:59 pm

how is it not a solution?

try this:
[url:2xkne0zy]http://dl.getdropbox.com/u/1013446/angles.cap[/url:2xkne0zy]
type in an angle

this one only moves clockwise
and at a steady pace
but if you wanted it to smoothly slow down,
and go clockwise or counterclockwise depending on speed
you could do that with a few extra events/actions
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun May 03, 2009 11:51 pm

Use the Sprite's built-in 'rotate toward...' actions in the angle category. If you use simple less than/greater than comparisons with angles, it won't work correctly over the 0/360 degree changeover. The rotation actions take care of this for you.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Mon May 04, 2009 9:24 am

Aha, I'll try that. Lucid, that cap is close to what I want. :D Deadeye, your advice is interesting. Ashley, could you make a cap please with key pressing events?
Well, I decided to put this funny cap: http://ioj.com/v/9vwdk :D (this character is copyrighted by Android Industries XD)
Can you make him aim gradually without changing his bone structure?

EDIT : with arrow keys, people, forgot to mention! :oops:
B
78
S
23
G
6
Posts: 234
Reputation: 7,662

Post » Mon May 04, 2009 9:44 am

Make a sprite - arrow - with hotspot to left. As always event use the sprite's rotate toward position expression.

[code:22nk6mfk]System: Always (every tick)
> Sprite Rotate anglediff(Sprite.Angle, angle(Sprite.X, Sprite.Y, MouseX, MouseY)) * TimeDelta degrees toward (MouseX, MouseY)[/code:22nk6mfk]

Be creative, you can achieve any effect with custom expressions!
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests