How do I can enable the player movement with mouse

  • I have created a game and upload it to the windows store 7 times and still receiving the same error. with the mouse controls. how can i enable the player movement with the mouse control?

    that is, if i move the mouse means the player must move with its direction.

  • Im not quite sure what u mean but i think you need the player to be where the mouse pointer is?

    If thats the idea, you just need to add a Mouse object and make a event like

    System, Every thick / Set position of Player to x - Mouse.X y - Mouse.Y

    Sry if i misunderstood you

  • If your trying to make a platform where the player moves towards the mouse then you'll need to set up some code to check where the mouse is compared to where the player is.

    If play.X > mouse.X then play.X = simulate move left

  • Thank you so much. That's exactly i needed.

    Please provide one more information. i have a sprite object that catches everything falling from the sky. and i want it to stay in the floor and when i move the mouse along with it, it needs to move only in left and right. not in 8 direction. ?

  • Pakost

  • Thank you so much. That's exactly i needed.

    Please provide one more information. i have a sprite object that catches everything falling from the sky. and i want it to stay in the floor and when i move the mouse along with it, it needs to move only in left and right. not in 8 direction. ?

    Every tick

    .. set sprite.X to Mouse.X

  • Yup, that should do the trick.

  • Try Construct 3

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

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

    thank you buddy. It is correctly working

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