Possible multi-touch bug, please verify

Get help using Construct 2

Post » Tue Feb 04, 2014 7:38 pm

Hi,
I'm new to this forum and I didn't find anything else than this (link removed) in order to help me in my quest.

You move the GREEN DOT by touching the BLACK SURFACE.
It means, the dot follows the finger.

When touching the black surface, the touch position is return in order to set an angle for the bullet movement of the green dot.

BUT

There is button on the left that the player will touch sometimes. there is no need to let the finger on the buttons but it can happens (if the player doesn't pull his finger up).

And that's the problem :

If a touch is done and hold before a touch on the black surface, the returned position is the wrong one (outside of the black surface).

I was testing with the touch manual to deal with it.
But I'm totaly lost with the TouchCount / ID / Index expression.

I need to always return a position within the black surface.


I hope someone can answer me !

Sorry if I made any mistake, I'm a french guy who really wants to learn Construct 2!
Perlin2014-02-05 15:06:16
B
4
Posts: 14
Reputation: 255

Post » Tue Feb 04, 2014 7:50 pm

Try this:

-> Touch, On Touched BlackSquare
     - set green dot vector towards Touch.X, Touch.Y

This ensures that the first touch is registered as long as it's on the black square.

If you want the green dot to follow the touch point then something like this should work:

-> Touch, is Touching BlackSquare
     - set green dot vector towards Touch.X, Touch.Y
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,206
Reputation: 43,834

Post » Tue Feb 04, 2014 8:16 pm

That's exactly what I do.

But the probleme is that the returned position could be any of the touchs.
because the blacksquare's touch isn't always the first touch or the only touch.

I need a way to define touchs. A way to return position of all touchs within the black square.

It's not a matter of 1st or 2nd touch I think.
but it has too do with a touch within a specified area.

(tested with cocoonJS on a Nexus 7 2013)

Thank you for the answer anyway !
B
4
Posts: 14
Reputation: 255

Post » Tue Feb 04, 2014 10:09 pm

Is there any layer zoom or parallax going on? Of so, put the layer name in brackets that your black square is on - like Touch.X("game"). Then use the same layer reference for all of your instructions. That's caught me out a few times. The only other thing I could suggest would be to post a capx....
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,206
Reputation: 43,834

Post » Tue Feb 04, 2014 11:33 pm

Here it is: TouchTest.capx

Touch&Hold a button then touch the black field, you will see what I mean.
B
4
Posts: 14
Reputation: 255

Post » Wed Feb 05, 2014 1:44 am

I see what you're trying to do.

Try this capx. I used a global variable to note the ID of the touch when the colored squares were touched and used that to eliminate any touches that were continued onto the black square. Works a treat (I'm quite happy because it was an experiment for me too)!Colludium2014-02-05 01:44:59
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,206
Reputation: 43,834

Post » Wed Feb 05, 2014 2:25 am

Thank you But it's the same.

If I hold a colored square the returned position is the colored square's one.

Maybe it has sometihng to do with this expression :

Set Angle Toward (Touch.X , Touch.Y)
B
4
Posts: 14
Reputation: 255

Post » Wed Feb 05, 2014 2:46 am

@Perlin. Interesting (= weird)... Your version definitely didn't work as you wanted when I tested in Chrome on my desktop (using mouse) and my fix made it work. I've just tested my version using cocoonjs (on i9100 and LG G) and it works on both.

Hang on - whilst I was typing I was messing around with it. Are you trying to hold down on one of the color squares and then have the bullet head towards a second touch on the black square?
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,206
Reputation: 43,834

Post » Wed Feb 05, 2014 3:03 am

Yes that's it !

I wan't to be able to not pull up my finger quickly each time I touch a colored square.

It's seems like the returned position is the one of the first touch each time.
I know that there is a way to choose wich touch I want but in my case, the position that I want can be the position of the first or the second touch.

B
4
Posts: 14
Reputation: 255

Post » Wed Feb 05, 2014 3:39 am

@Perlin,

OK, I've done some testing and I'm not sure whether or not this is a bug in C2.

I even went as far as creating a crosswalk app using a modified version of the capx I linked to above to isolate the cocoonjs wrapper (if you download it again you'll see that I've tried to isolate which touch event is registered by holding 2 touch IDs in variables).

Sometimes C2 is not registering a touch's end trigger - this is indicated by one of the touch variables appearing stuck at the last setting until a new touch is initiated to replace it (my events might be untidy and causing it, but I think it's ok). This seems to happen after a touch has been stationary for short period of time - a few seconds. Coupled to that, there does appear to be some cross-over when a new touch starts on the black square and a touch event on a colored square has been stationary. Here the co-ordinates of the colored square touch event seem to get passed to the wrong touch event.

Just as you initially reported it, but I'm at a loss to explain it.

Best submit it as a bug report, I think, and let the team take a look for sure. I can do it if you want, but you found it....

Ed Colludium2014-02-05 03:40:11
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,206
Reputation: 43,834

Next

Return to How do I....?

Who is online

Users browsing this forum: David181, plinkie and 9 guests