0 Favourites

Making a Touch Platformer : Controls Issues

  • Hello !

    I'm trying to make a platformer with touch control with only two "buttons".

    Basically, If you Maintain right, the Left button become a jump Button.

    If you maintain Left, the Right button become the jump button.

    Here is the thing :

    When i keep pressing Left (First) then Keep pressing right, I jump (That's good)

    But when i do the opposite (Right first, then Left), Left "Overtake" right.

    Here is the code :

    So, on the code side, whenever i touch the Left button, Touchstate =1.

    Any idea ?

    I personnally think this is a conflict in multitouch but i may be wrong.

    If you'd like, Here is the .Capx . You'll find this portion of the code in the Group PlateformMode->Control

    You can play here, On your favorite touch device

  • damasiusw

    Had a little look at this just now. It seems it was related to the fact that you had the touchstate variable as a local one rather than global. If you move up to the top so its global then it works for both ways. I guess C2 was setting it back to 0 every time it was running through the code? By moving it out it did cause some other issues with the controls going a little funny so I changed a few other bits. I've attached the .Capx file edited and also a link to it on dropbox. Hopefully this helps =) The lines I amended I have bookmarked so you can see what changed (around 3/4 lines). You will also need to change back the text - test as I changed it to append so I could see what values of touchstate were being passed.

    Capx:

    https://dl.dropboxusercontent.com/u/631 ... trols.capx

    Online Link:

    https://dl.dropboxusercontent.com/u/631 ... index.html

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Ho you !

    Thanks a lot.

    It seems that a new weird problem has appered but i'll try to figure it out by myself first

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