Using both the Mouse and Touch objects, possible?

0 favourites
  • 7 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I've come across a small problem where i have a start screen that sets a variable to either "mouse" or "touch" depending on which interaction has been done. This works fine and the main screen loads.

    The issue for me is that i'm not sure of which is the best approach when trying to resolve the input method? In my code i try to use both according to the top part of this image:

    <img src="http://i.imgur.com/rGwprLv.png" border="0" />

    The code above is the way i tried first, that is if the mouse is over OR touch i touching. However, they seem to conflict and only the touch works. So underneath it you see the approach that did work but since i am using one event sheet for my whole game, there is a risk that i will have to put it a lot of input checks.

    My question is if there is a better way, perhaps somehow to utilize a function for these repeating checks?

  • You could just use the touch object if you're only going to use left mouse-button input.

    Touch object is set on use mouse input in the start.

    On touch is the same as on mouse left button down in that case.

    You cant use mouse-pointer in touch.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want to use a different input method for mouse and touch i suggest making a mouse group of events and a touch group of events. If on touchscreen disable mouse-group and if mouse is available disable touch-group.

  • Ya ok... yeah sorry, i already new about the Touch "act as mouse" type of setting. The thing is that i want to scale the graphics on mobile devices and since my Galaxy S4 and PC have the same resolution, i need some other way to tell them apart. Is there like a "is desktop" or "is smartphone" check?

  • yes, there is a system condition Is on mobile device.

  • Superb thanks! ^^

  • If you want to use a different input method for mouse and touch i suggest making a mouse group of events and a touch group of events. If on touchscreen disable mouse-group and if mouse is available disable touch-group.

    Would you have a sample .capx on this?

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