How do I take pointer events into account?

Get help using Construct 2

Post » Wed May 03, 2017 2:21 pm

I saw that r244 includes a change in touch events / pointer events (from r240). I want to take these changes into account, but couldn't find any further documentation on how we should handle Touch object / conditions differently.

Here is the issue I want to fix:
  • We have some games that used the condition, Touch --> On any touch start.
  • After updating to r244, that condition seems to trigger twice when the player taps once.
  • Problem is observed only on Android+Chrome.
  • Even on Android+Chrome, the problem doesn't happen on preview over LAN, only on exported games.

Examples:
Rainbowbit - http://www.thesheepsmeow.com/html5/rainbowbit/
In this game, tap to toggle between clockwise/counterclockwise. However, on Android+Chrome, each tap counts twice, making the game unplayable.

Snack Shack - http://www.thesheepsmeow.com/html5/snackshack/
In this game, tap to place a food item. However, on Android+Chrome, each tap counts twice, dropping 2 food items at a time.

From the release notes from r240:

For a long time there have been two APIs to detect touch input: Apple-style touch events (e.g. "touchstart", "touchend") and Microsoft-style pointer events (e.g. "pointerdown", "pointerup"). Pointer events have subsequently become the preferred standard and browsers are starting to move to the new API. C2 now uses standards-compliant detection of pointer events and (as before) will use pointer events instead of touch events if available. The reason this is being highlighted is because Chrome 55 will enable pointer events, which means C2 games will switch from touch events to pointer events from then on. Despite the fact we've long supported pointer events for IE and Edge, this could cause some bugs or incompatibilities if Chrome has any differences between the two APIs, so it's worth looking out for any issues around touch input in Chrome.
B
7
S
3
Posts: 7
Reputation: 1,064

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 30 guests