How do I, Make an object change sprites using mouse position

  • To be more clear, i want my character to change sprite/ rotate using other sprites, by the mouse position, I tried using

    Mouse.X > Character.X and Change position so it looks to the right and Mouse.X < Character.X and change position so it looks to the left, but when i change the X to Y, the Y Events (Mouse.Y > Character.Y and Mouse.Y < Character.Y)

    seems to over ride the X events (Mouse.X > Character.X and Mouse.X < Character.X), it only make it look up and down and not left and right. (To be more clear I made to another events using Y coordinates instead of X coordinates and it over rid the X events.) Does anyone know any solutions for this?

  • be more specific..name the player and the other sprite .. the player are moving with 8d?other spite what is? turret ? cannon? controller object? is button when your player collide?

    your character how is look? is square, triangle, ball?

  • add behavior turret on your character and use event set angle toward position to mouse x and Y. ?

  • I think this is what you mean

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No i meant like change the animation of the object by the mouse position.

  • You could replace the actions I posted above with the 'use animation' action.

    You might need to be clarify though, it's not really clear what you're trying to do.

  • What I meant is that the animation of the object would change if the mouse is in a certain area, for example if the mouse is at the upper area of the object, the object would change its animation because the mouse is on the upper area of the object.

  • You can repeat the same for X coordinate.

    Sprite's image point should be in the center of the image.

  • It seems that when the X events (Character.X < Mouse.X -> Set Animation to "Right" and Character.X > Mouse.X -> Set Animation to "Left") is on top of the Y events (Character.Y < Mouse.Y -> Set Animation to "Down" and Character.Y > Mouse.Y -> Set Animation to "Up") the X events only work and the Y events doesn't work. Vice Versa

  • This works correctly:

  • I'm not sure how you did it, but It doesn't work for me, the only events that work for me are the vertical events.

  • You are doing something wrong.

    Is this how you want it to work?

    capx file

  • I copied it from your capx. and when i literally change it from your sprite to mine, it doesn't work anymore, I guess it's my fault.

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