How do make an sprite rotate 90 deggre in move.

0 favourites
  • 6 posts
From the Asset Store
Avoid obstacles and survive as long as you can!
  • 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

  • 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

  • [quote:3rl6g7tj]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...

  • It's needed in that case since the rotation is being done manually. "Rotate" is not part of the behavior.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ahh ok thanks

  • Thanks ! Im gonna check it and post if its work for me ; )

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)