How do make an sprite rotate 90 deggre in move.

Get help using Construct 2

Post » Fri Oct 24, 2014 10:07 am

How to move object like that ? im trying rotate but object cant stop rotating, or rotate instantly 90 degree. I need smooth rotate in move, from horizontal to vertical.

imageshack.com/a/img538/3230/hhPArM.png
B
5
Posts: 22
Reputation: 269

Post » Fri Oct 24, 2014 8:21 pm

There are a few ways.

One is to give the the object the bullet behavior and add an event like this:

Every tick
--- sprite: rotate 10*dt degrees toward -90

Where 10 is the turning speed in degrees per second and -90 is the end angle.


Another way that is useful from a trigger is to add a instance variable "turningSpeed" to the sprite to tell how fast it turns.

Every tick
--- sprite: rotate clockwise self.turningSpeed*dt

start of layout
--- sprite: set turning speed to -90
--- wait 1.0 seconds
--- sprite: set turning speed to 0
--- sprite: set angle to -90
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Fri Oct 24, 2014 8:52 pm

One is to give the the object the bullet behavior and add an event like this:

Every tick
--- sprite: rotate 10*dt degrees toward -90


Is the *dt necessary in events using a movement behavior, they already include it in the behavior movement according to Ashley's tutorial on *dt that says using it in behavior controlled movements could actually make the event framerate dependant again. Or am I misreading this...
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 636
Reputation: 9,333

Post » Fri Oct 24, 2014 9:08 pm

It's needed in that case since the rotation is being done manually. "Rotate" is not part of the behavior.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Sat Oct 25, 2014 1:05 am

Ahh ok thanks
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 636
Reputation: 9,333

Post » Sun Oct 26, 2014 8:02 am

Thanks ! Im gonna check it and post if its work for me ; )
B
5
Posts: 22
Reputation: 269


Return to How do I....?

Who is online

Users browsing this forum: el3um4s and 8 guests