[SOLVED]Can I rotate an object towrads a position slowly

0 favourites
  • 12 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • Hello,

    i have an object constantly moves forward during game. Player decides where it will go by clikcing/tabbing screen.

    each time player tabs a position i use:

    object - rotate 30 degrees towards (Mouse.X, Mouse.Y)

    but this rotation is instant. i want a smooth movement like rotating the object within a time, instead of rotating instandly.

    How can i make this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try with the rotate behavior

  • Rotate behavior makes an object cosntandly rotate around itself. if u set its speed to 0 it stops turning around.

    Even onbject has a rotate speed you cannot rotate it towards a position within a time. action makes it instandly rotate towards position. and it continues spinning around itself

  • A simple way is to use the LiteTween behavior :

    Try a configuration like this for your sprite :

  • i cannot find an action which will replace the one below according to your attached behavior:

    "object - rotate 30 degrees towards (Mouse.X, Mouse.Y)"

    edit: im not permitted to post links yet sample is attached

  • Sorry if I don't get what you are asking for ...

    Is it this ?

  • Yes something like that.

    However as i can see from your expression, that tween behavior will not help me. Couse it is always turns the objects in same rotation. and exactly to the mouse click position. So when i click to a place that will force it to turn to opposite direction, object spins around.

    • What i am trying to do is moving the object towards its forward angle.
    • this angle will be determined by player with mouse clikcs.
    • object will turn towards to the mouse click location like 30 degrees. or lesser if its less then 30 degrees.

    why 30 degrees? couse i want the controls a bit harder.

    my project works perfectly. however i need my object to turn slowly, not instant

    Thank you for your help.

  • any ideas about this?

  • There is a "rotate-to" plugin that should do exactly what you're asking. Can't find it for the life of me, however...

  • Would it work to use the action in your first post under a every tick event, only change 30 to 30*dt?

    • Rockwell, cant found that plug-in either but thanks for the info. I will be looking after it.
    • R0J0hound, you are right it would work if i create a function that starts a session to set angle every tick of the game when player clicks, and when clicks again, reset it and start another one. I would do it like this if i were writing this in spagetti. What i am looking was shortening the time to develop games when i buy this product. C'mon it is a very basic animation for a game to turn an object. I thought i didnt knew how to do it with construct 2.

    Now i solved the issue by turret behaviour. (attached)

    When player clicks i create an invisible target for the turret. Turret makes the object slowly aim to the target. But target dissappears before turret fully aims. Like 30 degrees.

    Why i am so obsessed about not aiming fully but some degrees is, im trying to make user constantly click or tab the game. It gives harder control over object and force player to make movement strategies. In full version player tries to catch something within a time withouth hitting tings. Also clicking that much needs full consantration with a suspicious kind of addiction to the game (doesn't works for everyone see flappy bird).

    Thank you very much for your attention everyone

  • I fail to see how it's like spaghetti however after re-reading your op I also see I missed some details.

    -Cheers

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