Detect Touch

  • I want to detect if there is a Touch screen when my game is run.

    I can do this by putting a Touch object with touch only and no mouse.

    However there seems to be no way to switch on Mouse support inside the Touch command later on, as I also want to support mouse, and having the Touch object react to mouse is very convenient.

    Is there something I am missing?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • keep a title screen so that when someone touches it, take it one layout, for mouse, another layout

  • Don't make separate layouts! It's much easier to have one layout that does everything.

    Why is it important to know? Can't you just drop in the Touch object and use that solely?

  • ash1221 that's what i am trying to do, but the Touch object cannot be modified from layout to layout. If i disable the mouse support then i am without mouse for the whole project

  • Ashley i just want to know if the device has touch, and if so the game controls will be slightly different from mouse.

    but i want mouse too, without having to do touch + mouse conditions all the time

  • There is an event in the "System" List that checks if it's on a mobile device !

    Try it out !

  • Whiteclaws what's if it's on a Windows8 Tablet or touch enabled laptop? These will become very common in 2013

  • You may disable mouse emulation on your touch object, check if the first action done by the player (ex. start screen) is from a tap or a click and then set a global value that activates one of your two control systems.

  • The best solution is just disable 'Use mouse input' in the Touch object and handle mouse and touch input separately.

  • Yes I know I can do that Ashley, but it's a lot of work and I am very lazy!

    I am trying to see if I can make a duplicate of the TOUCH behaviour, and use this without mouse on the first screen only!!!!

  • Indeed my theory works!

    I duplicated the Touch object, edited it a bit, and renamed it to TouchDetector.

    i don't put a mouse to TouchDetector, and it fires as soon as i do a touch!

    the rest of the game works with the standard Touch!!!

    C2 is so great and flexible for diy additions!!!

  • Can't you just use the Mouse plugin in the same way? If 'on mouse click' fires then the user is using a mouse otherwise they're using touch.

  • Ashley in any browser, I w ant to detect if the device has touch support. In JS is " 'touchstart' in window " ... so how I can.... ?

  • When I add event using browser object I can´t see "Supports touch device", only has"Supports requesting fullscreen". Is possible to add "Supports touch device" ?

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