How to move left or right when jumping?

  • Hi,

    I am currently making a normal platformer game for mobile devices with Touch Controls.

    For some reason when i press my "jump-button" player stops moving left or right and only jumps while standing still. How i can fix this that i can jump and move same time when player is in the air (like the default controls "arrows" do, if you press right-arrow and you also press up-arrow, player will jump to the right and not stay still.)

  • Use "Is touching object" events to move left or right and "On touched object" event to jump. Also, I suggest previewing your project in Chrome, as Firefox doesn't work well with multi-touches.

    See this tutorial:

    scirra.com/tutorials/4973/multi-touch-movement-controls

    .

    If all of the above doesn't help, please post your capx file.

  • Hi and thank you for trying to help me.

    The tutorial you linked was already familiar to me, I have made touch-controls already using it for the help but still cant jump left or right with my character (I guess I've done something wrong).

    Unfortunality I can't post capx.file for some reason, I can send it by email if you dare to give me adress.

    Here are two different codes I made when trying to create touch controls.

    First Picture named "touch" is done without the material in the tutorial you mentioned.

    Pictures named "touch_like_tutorial" are done like in the tutorial, I had to take 3 screenshots so the top code is the last visible code in the previous picture.

    Hope this helps, but anyway thanks for your effort trying to help me :)

  • Remove/disable everything and try this simple code:

    Is touching LeftButton -> Player simulate pressing Left
    
    Is touching RightButton -> Player simulate pressing Right
    
    Is touching JumpButton -> Player simulate pressing Jump
    

    If it works fine, then you can add sub-events to each of those 3 events, in which you can check if player is on the floor and change animations if necessary.

  • Try Construct 3

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

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

    OK, I got it finally fixed! Thank you so much for your help :)

    For anyone searching for the help to the same problem, here's how I fixed it:

    1. I deleted everything from my Sheet.

    2. I wrote the following codes only in the sheet:

    Event: Touch -> Is touching left-button Action: Player -> Simulate pressing left

    Event: Touch -> Is touching right-button Action: Player -> Simulate pressing right

    Event: Touch -> On touched jump-button Action: Player -> Simulate pressing jump

    3. I also had to change some Player's movement settings like gravity and jump strength.

    Once again a big Thank You for the help and have a nice Christmas!

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