How to know if the Touch is outside the screen?

0 favourites
  • 4 posts
From the Asset Store
Save hours of work by resizing items on your game screens.
  • Hello,

    How to know if the Touch is outside the screen?

    When I drag (in Debug Preview) out of the screen, I get Has Touch 0 = true, but Touch object stops detecting x,y. So I have no way to tell where it is or if it is on-screen or not.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1. That appears to only happen with debug view, since with a regular preview you can detect touch way outside of the window, even returning negative touch coordinates

    2. It's relatively safe to assume that since a regular preview works fine, it will also work fine after export. In that case you can probably just check along the lines of "if touch.X < 0 OR touch.X > viewportWidth OR touch.Y < 0 OR touch.Y > viewportHeight

    3. If you think of any touch device like a phone... how would you ever touch something that's not on screen?

    The only question is why this behaves differently in debug view, but it has probably something to do with the interface of the debugger.

  • 3. If you think of any touch device like a phone... how would you ever touch something that's not on screen?

    Thank you.

    True. But the game works on web and desktop too. I couldn't make sure if that is working because of the mismatch between Debug and Release behaviors.

  • But the game works on web and desktop too.

    Haha ok, that makes sense. I guess you can't use the debugger when testing that specific case. Not sure if it's really worth to file it as a bug report but it can't hurt

    github.com/Scirra/Construct-bugs/issues

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