How to make touch controls for 2d game?

0 favourites
  • 3 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • I am making a 2d platformer game and I want to add simple touch controls

    What I want to add

    Right, and left

    Jump, and duck

    And Interact

    I want the onscreen buttons to stay in one spot, and so that when pressed it just simulates the key pressed on the keyboard

  • Add the Touch object, then For each button sprite, add: Touch > On tap object (or holding for left/right) > Button. Then the action for that event would be Player > Simulate Control > Jump (or whatever you need)

    For ducking, you would need to check if duck is being held and make a player animation for ducking with a smaller hitbox, since ducking isn't built in to the Platform behavior (I think),

    For interacting, you would maybe need the button to spawn a hitbox object in front of the player, and if it hits an object, run events for what happens when you interact with it.

    Hope this helped

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add the Touch object, then For each button sprite, add: Touch > On tap object (or holding for left/right) > Button. Then the action for that event would be Player > Simulate Control > Jump (or whatever you need)

    For ducking, you would need to check if duck is being held and make a player animation for ducking with a smaller hitbox, since ducking isn't built in to the Platform behavior (I think),

    For interacting, you would maybe need the button to spawn a hitbox object in front of the player, and if it hits an object, run events for what happens when you interact with it.

    Hope this helped

    Thanks, basic controls working so far

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