# How to do multiple touches on screen?

**URL:** <https://discourse.processing.org/t/how-to-do-multiple-touches-on-screen/35534>\
**Category:** Processing for Android\
**Created:** [March 3, 2022, 9:49am UTC](https://discourse.processing.org/t/how-to-do-multiple-touches-on-screen/35534 "2022-03-03T09:49:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Coder1](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@Coder1](https://discourse.processing.org/u/Coder1)\
**Post date:** [March 3, 2022, 9:49am UTC](https://discourse.processing.org/t/how-to-do-multiple-touches-on-screen/35534/1 "2022-03-03T09:49:27Z")

</div>

Hello

I have been making a game on Android and I wanted to know how to make multiple touches on the screen. For example I created two buttons. The first is for running and the second is for jumping. I wanted to know how to run and jump at the same time because you normally cant have 2 different mouseX and mouseY positions at the same time right? I hope you understand what I mean, thank you

---

<div class="post-metadata">

**Author:** ![TimeLex](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/timelex/32/12869_2.png) [@TimeLex](https://discourse.processing.org/u/TimeLex)\
**Post date:** [March 3, 2022, 7:39pm UTC](https://discourse.processing.org/t/how-to-do-multiple-touches-on-screen/35534/2 "2022-03-03T19:39:19Z")

</div>

You can use `touches`. With `touches.length` you can get how many touches are on your display and with `touches[i].x` and `touches[i].y` you can get the position of the touch `i`.  
Warning: `touches[i]` does not return a PVector. It returns a pointer (`processing.event.TouchEvent.Pointer`) but you can just convert it with `PVector v = new PVector(touches[0].x, touches[0].y)`.  
Here a basic program to test this:

```auto
void setup() {
  fullScreen();
}

void draw() {
  background(255);
  
  stroke(0);
  strokeWeight(15);
  for(int i = 0; i < touches.length; i++)
    point(touches[i].x, touches[i].y);
}

```

Good luck with your project!

---

<div class="post-metadata">

**Author:** ![Coder1](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@Coder1](https://discourse.processing.org/u/Coder1)\
**Post date:** [March 4, 2022, 12:12pm UTC](https://discourse.processing.org/t/how-to-do-multiple-touches-on-screen/35534/3 "2022-03-04T12:12:04Z")

</div>

Thank you, it works now!😁👍

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [March 4, 2022, 5:19pm UTC](https://discourse.processing.org/t/how-to-do-multiple-touches-on-screen/35534/4 "2022-03-04T17:19:42Z")

</div>

> [@TimeLex](#):
>
> You can use `touches` . With `touches.length` you can get how many touches are on your display

Fantastic and creative
