How do I change "Use mouse input" programatically ?

0 favourites
  • 9 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hi guys !

    That's pretty much it...I need to change the TOUCH object property "User mouse input" from NO to YES and backwards programatically.

    I've search around pretty much but didn't find an answer.

    Can you help a newbie ?

    Thanks alot !

  • There's probably a good reason why you'd want to do this, but I can't think of any..

    Guess the only real solution would be putting the touch events and mouse events in different groups and enabling/disabling them..

  • Maybe there is a reason ... dunno..!

    The reason I need this functionality is because I have to position an object in the screen on a certain position. Mouse.X and Mouse.Y are only detected for mouse clicks and Touch.X and Touch.Y for touch inputs so I need to find out at the initial layout if the user is using the mouse or touch and therefore specify the object position on screen to br retrieved from mouse or touch coordinates.

    Touch.X and Touch.Y should give the same coordinates that Mouse.X and if the Touch property of use mouse is enabled....

  • If you are using mouse input on touch ( so set to yes) you can always just use touch.x,touch.y..

    touch - coordinates are only registered while touching (so in the case of the mouse while left mouse button is down)

    otherwise they return 0

  • LittleStain.. I was writing at the same time you were..

    Well thats the issue, my project isnt beahving like that. When I use the Touch.X and Touch.Y and place the object x and y coordinates at those positions the object appears in the top left corner ... like it is deteting my mouse coordinates at 0,0 . (Im using the mouse but intend this to work on a tablet).

    Or Im doing something wrong or there is a bug in r178.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you aren't touching the screen, so also when the mouse left button isn't down touch.x will be 0 and touch.y will be 0..

    mouse.x is the place the mouse cursor is (so even when there is no other input) touch doesn't have a cursor, so no value if there is no touch..

    To simulate touch with the mouse the left mouse button should be down..

  • I see what you mean...

    I am using a combination of:

    If object A is overlaping object B and "Touch Is not touching A" (used an invert here) then position C at touch.X and touch.Y.

    Basically what I'm doing is draging an object to a target and releasing the mouse. If it's over the target then get the position where the mouse pointer was released.....but this with touch events.

    Anyway I might be doing something wrong here...dunno if inverting "Is Touching" works like not touching .. or releasing finger...

  • Sounds like you should be using the DragDrop behaviour, rather than manually doing it.

  • Yes you are absolutly right Blackhornet..

    As a matter of fact I am using DragDrop behaviour but for some reason I made it harder then simplifying. I think its working as I havn't tested in a touch device..

    Thanks guys for your great help as always !

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