[Solved]Touch vs Mouse

0 favourites
  • 6 posts
From the Asset Store
Side-Scrolling Game "Vikings VS Skeletons" with complete Source-Code (.c3p) + HTML5 Exported.
  • I get it, but how do I fix this?

    pong game

    on mouse click

    system every tick, Mouse.X

    So I changed it to Touch.X for a mobile game

    But the object now is like glued as far left as it will go at the start of layout. It to works on mobile the way I want it to only when I'm touching the screen. When I'm not touching the screen it slaps to the left again.

    Thanks anybody.

  • Touch - Is in touch -> Sprite set position to Touch.x, Touch.Y

  • You may need another variable if what dop200 gave you does not solve it completely, call it lastX

    On any touch end > set lastX to Sprite x then use Else after your is in Touch event to set Sprite.X to lastX

    Or if it still snaps left use every tick > set lastX

    Also,set lastX to middle of screen at the beginning of the layout or where you want your Sprite to start the game.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks Guys, sorry I didn't say what I did to fix it.

    Since it's just a simple entity with a collision.

    I deleted Every tick Touch.X

    I added "drag and drop" to it and made it horizontal only.

    Also had to remove "bound to layout", "drag and drop" didn't play well with that.?

    Summary:

    I added "drag and drop" "horizontal only".

    the object also has "solid"

    And deleted everything else.

  • Actually, I may try these suggestions though.

  • Ok,

    So In the end or for now,

    I have changed it to 8 way set it to left and right,

    then

    Added touch controls left and right.

    Why because the drag an drop was way to sticky or laggy for slide left and right movement.

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