Soft Rotation

This forum is currently in read-only mode.
From the Asset Store
15 loopable and soft rain ambiences, specially designed to make your projects sound relaxing
  • 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)?

  • 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?

    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)?

    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

  • Sorry man, forgot to add "gradually". Edited first post.

  • 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

  • Thanks, but that's not a solution. I think Timedelta can help somehow, but how...

  • "Rotate 360*TimeDelta degrees" will make a sprite rotate once per second.

  • how is it not a solution?

    try this:

    http://dl.getdropbox.com/u/1013446/angles.cap

    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

  • 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.

  • Aha, I'll try that. Lucid, that cap is close to what I want. 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 (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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Make a sprite - arrow - with hotspot to left. As always event use the sprite's rotate toward position expression.

    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!

  • Ah, not working.

  • Your weapon sprite's graphics (sprite22) are drawn with its top upwards. In Construct the top of things should point towards the right if you want to use methods that use the angle like the 'rotate towards' method and make it behave as expected.

    Construct will try to set the angle of any object tied to the bone behavior at every tick, so you'll have to set the angle to what you want to point it at instead at every tick as well.

    I've rotated your weapon and added a sprite target cursor that you can move with the arrow up and down keys. At every tick, Construct will make the weapon point toward the target. You can get the .cap here.

    EDIT: Seems like I misunderstood you earlier. You wanted the weapon to rotate smoothly towards the minimum and maximum aim angle and back to zero if no key was pressed. After some experimentation, I've made a solution that does that. It's a bit hard to explain how, so just have a look at the .cap.

  • Ashley, could you make a cap please with key pressing events?

    Have you tried some of the tutorials listed on the site? That's a pretty simple event so you might want to work on your general familiarity with the event sheet editor.

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