Sprite Animation switch on mouse Location

  • Sorry if this is re-post I looked before posting this but couldn't find anything.

    I have a Sprite that is the "Player" (Front) and I have a Right, Left, and Behind Frame for when he is looking in a particular direction.

    I have no idea on how to go about doing this I basically want my "Player" to display the "Behind" Frame for when my mouse is above him and display the "Right" Frame for when my mouse is to the Right of him and so forth for the "Left" and "Front" Frames.

    Sorry if I'm not clear enough, I read the rules I know this is not suppose to be a make my game for me deal I want to know how this would be made for future reference and if I'm not Clear enough I will try to be more clear if no one understands.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you can try to use system expression to calculate the angle between mouse and player, if it is between 45 to -45, then right, if between 45 to 135, then up and so on

  • An easy way to get the angle is to use a sprite to draw a line from the player to the mouse position. Then check the angle of that sprite like yuquanzhou007 suggested.

    Here is a quick example: MouseAngle.capx

    PS: The MouseAngle sprite is supposed to be invisible, but I left it visible to illustrate how it works.

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