multiple touches in areas

Get help using Construct 2

Post » Tue Mar 26, 2013 7:59 pm

i'm looking for a way to manage 4 touches on one screen.

there should be 4 sprites. one at each corner and they should be movable by a touch in the appropriate corner.

My idea was to divide the screen in 4 invisible large sprite which cover up each corner for sure. can i somehow give every touch a different ID, according to the invisible sprite touched?

if i would do so, touch should be able to touch more than one sprite .. like sprite1 on layer1 and sprite2 beyond on layer0. is it possible to detect that with the event "is touching object" ?`

do you guys know what i mean? its a bit hard to explain. at the end, four players should be able to move their own sprites in each corner and if their touches end and the touch again, it should't confuse my game.

cheers!

EDIT: Problem solved. See comment below for Live demo and capxphilx2013-03-30 11:01:43
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Tue Mar 26, 2013 11:31 pm

<SNAP> I think the https://www.scirra.com/manual/119/touch manual beat me to it.

each touch has it's own ID. Just track with Touch ID touched what sprite and track it. All touches are passed through the layers. I'm not sure if it's top down or bottom up for even triggering.
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Thu Mar 28, 2013 6:52 pm

thanks for your quick answer. i read the manual, but i'm still not getting it very well. I understand that every Touch is given an ID but i havent really figuered out how to use it right.

hm its tricky.
i tried something. have a look if you want to. its not quite working yet.
Live Demo
https(colon)//googledrive.com/host/0B7m-eoWIKsSMRklGenZEY1FMUlU/index.html
capx File
https(colon)//www.dropbox.com/s/ces4n4m04giuipa/id-test.capx

i have to work on it much more but I haven't got much time right now. Have you ever achieved a good working multi touch game?
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Sat Mar 30, 2013 11:01 am

i made it.
here's a live Demo
https://googledrive.com/host/0B7m-eoWIKsSMeVNlVzBzMTdFanM/index.html
and this is the capx file.
https://www.dropbox.com/s/j5v8oi5ruuyyp4y/multiple_touching.capx

maybie i'll do a tutorial later on.
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Thu Apr 25, 2013 1:15 pm

Thanks for sharing @philx!

I've been trying to solve this for a while, but couldn't quite get my head around it. Great work!!

B
18
S
4
G
2
Posts: 77
Reputation: 1,588


Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 21 guests