How do I fix my touch controls?

  • The game I am creating is for Android and uses touch controls. When hold your finger on the left side of the screen the helicopter flies upwards otherwise it falls down. I also have the helicopter shoot bullets when you hold on the right side of the screen. The bullets angle themselves to the position of your finger. I used set angle towards position when spawned to make the bullets aim towards Touch.X and Touch.Y. However, sometimes the bullets will go towards the left touch as there are often multiple fingers on the screen at once. How would I get the bullets to only fly right? I would need to differentiate the left touch from the right and I have tried and failed several times to do so.

  • try using the function "Has Nth touch".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • add an (invisible) sprite on the right which is your trigger to fire.

    event

    On touched object sprite

    action

    shoot

  • add an (invisible) sprite on the right which is your trigger to fire.

    event

    On touched object sprite

    action

    shoot

    That is what I am doing. The goal is for the bullets to aim themselves WHERE I touch.

  • Ahh, then flip it.

    On the left, add a button which is your trigger to launch up ...

    On the button shoot event, add

    is touching objectUpDown (inverted)

    So it wont trigger when you touch control to go up and down

  • The idea is to have the chopper to have the ability to fly and shoot at the same time.

  • example capx

    example demo

    You will require to use an object you touch to have the second touch working.

    Red square is elevation, blue is the target. Tested on my phone.

  • Thanks so much!

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