How do I Animate character with Touch Input?

0 favourites
  • 15 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I created a basic platformer game that uses the arrow keys to move and jump. It works great when the keyboard is used.

    However, when I tried to implement the "Detect Input" example that comes with Construct 2 and use the on-screen arrow input, my character no longer does the walking animation when moving left/right, nor can they jump. The character just glides side to side when the on-screen arrows are used.

    Any help is greatly appreciated.

    Here's a short video showing it:

  • I don't believe the "every tick" is needed prior to touch or keyboard events since they are triggered events via the touch/input action anyways.

    You could also simply add the is touching condition as a -OR- to your keyboard arrow event and save repeating all the associated events.

    You could still turn it off and on by making a variable that is either 0 for keyboard (default) or changed to 1 when player selects touch option (or mobile is detected).

    You would then add a control (is-not-equal-to) 0 (or an is-equal-to 1) condition in the touch part of the -OR- event.

  • Oh sorry, the Every Tick method just contains something to check the players running speed. If they're running, they can jump a little higher. The Mobile controls aren't subevents on Every Tick.

  • My bad if I had of looked closely I would have seen they weren't attached to the controls.

  • The problem with using "Or" events is that I'm checking to see if "Right Arrow is down" and "Platform is on floor" to determine if the walking animation should play.

    If I add "Is touching rightArrow" to it and make it an "Or" statement, it changes to:

    "Right Arrow is down" or "Platform is on floor" or "Is touching rightArrow"

    When I need it to be:

    "Right Arrow is down" and "Platform is on floor"


    "Is touching rightArrow" and "Platform is on floor"

  • sub events:

    if platform is on floor

    (sub)--right arrow is down

    --------- OR

    --------- is touching right arrow

  • sub events:

    if platform is on floor

    (sub)--right arrow is down

    --------- OR

    --------- is touching right arrow

    Thanks for showing me how to set that up

  • I fixed the walking issues by saying if the player's platform is not moving and is facing right and if the right on-screen arrow isn't being touch, then play standing animation. This makes the player's walking animation happen with on-screen controls. I can't get jumping to work, though.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is there a reason you're using the 8-direction controls in addition to the platform behaviour?

    EDIT: oh, anyhow, it looks to me like you've got your jump actions on the event rather than the sub-event..

  • Are they not needed? I'm just trying to support web browsers on both computers and touch screens.

  • well, platform has platform movements built in. 8-direction is usually more for overhead views and spaceships and stuff. it doesn't have a jump built in, for example. up just goes up.

    they're just two different types of movement behaviours. I don't know exactly what you're doing, but if you're jumping, my guess is you just want the platform behaviour.

  • Oooh okay. Thanks for your help! I thought you had to use the 8 point for touchscreen, I didn't notice the simulate control option under Platform.

  • I got the touch-screen arrow keys working, thanks to everyone who posted and helped me out. The only issue I'm seeing is that the character either walks or jumps, but doesn't jump forward. Any ideas?

    If you're on a touchscreen device, you can try the game here to see what I mean:

  • It works fine, but I'm not on touchscreen...

    probably something to do with registering two touches?

  • The best I could do was to add a platform simulation of jump and move right when the on-screen up arrow was pressed, which wasn't great at all. I think I may have to scrap touchscreen support for now.

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