How do I change keyboard to touch

  • Hello to all, in my game i have a sprite who move from left to right, the spriet is controlled with just the keyboard, left and right.

    now i added the touch object because i would like to test that on android, but how to tell to touch object the keyboard left or right is down?

  • Short answer: you don't..

    Just add a new event for the touch controls you want..

    Using an "or"-block would probably be too much of a hassle here, because the touch event probably needs conditions to work as expected and this would then conflict with the keyboard event..

    You could add the browser object to check if on mobile and put the controls in seperate groups and activate/de-activate when needed, but the way you explain your controls, this wouldn't really help except for making your event-sheet more readable..

  • i dont have nothing in my events for the keyboard at the moment, for my moving sprite i just added the 8 directions behaviour, with the directions left-right only :p

  • Something like this should work:

    on touch

    system compare two values: touch.x>player.x

    • player 8 direction - simulate pressing right

    on touch

    system compare two values: touch.x<player.x

    • player 8 direction - simulate pressing left
  • Try Construct 3

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

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

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