How to rotate one object towards another object?

This forum is currently in read-only mode.
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.
  • Hi!

    Please, help me to solve one problem.

    There is a scrolling platform game, main character and something (may be arrow) in top-right(always), which shows where is the door(exit), for example. Question is how to make that arrow always rotates towards the door depending on the main character's position

    I don't know, but "set angle towards an object", "rotate towards.." etc, doesn't work properly - it rotates arrow only once in the beginning of the game.

    Thanks!

  • You want it to be always active, so put that action in an event with "Always" condition. That way it will always update the angle.

  • I put this action in "Always" condition, but it doesn't work. ..

    This is very simple example - http://willhostforfood.com/?Action=download&fileid=58261

    Please, look at it. There is pink arrow and red box in right-bottom. The arrow must rotates towards the box. Look at conditions. But it doesn't...

    What is your opinion?

  • The default angle is 0, which is facing right. The image of the arrow faces north, so it'll always look like it's off by 90.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Rich,

    Ok. I understood you.

    Now there is right angle (not off by 90).

    But the arrow doesn't always rotate. It must be like.. compass arrow! Slightly to the right, slightly to the left - always changes angle when the sprite moves left or right, up or down.

    Do you understand me?

  • Assuming that you have Arrow, Door and Player sprites:

    +Always
    

    Arrow: Set Angle to angle(Player.X,Player.Y,Door.X,Door.Y)[/code:2brvn5nu]

    That will always point to the door in relation to the player, not arrow itself.

  • Mipey,

    Wow! Thank You so much!!!

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