Request - a way to turn off touch rightclicks

0 favourites
  • 15 posts
From the Asset Store
A well commented RPG game template to learn from or use as a base for your own game!
  • I'm using the touch plugin for both touch and mouse controls, but there's a problem - 'on touch' fires for left, middle and right mouse clicks, and I have no idea how to differentiate between them as adding a 'right mouse is down' condition doesn't work. I tried adding an 'on right click' event before it to set a variable but it isn't working right, presumably because triggers run out of sequence.

    As it is, it appears the only way to bypass this is to have a mostly redundant set of code for mouse control.

    Something like an extra option in the properties of the touch plugin for use mouse input, instead of yes/no, perhaps yes/no/left click only would work well.

  • It's a conflict between Touch and Mouse, you should separate them as touch for mobile version and mouse for desktop version.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If C2 had the option I mentioned, I wouldn't have to. It would very useful to myself and I think others as well, so we could have one set of code rather than needing duplicate code for both, and it seems like it wouldn't be hard to implement.

  • .. It would very useful to myself and I think others as well, so we could have one set of code rather than needing duplicate code for both...

    I do agree this would be useful and hope that it can be implemented

  • The intent in this case is that you would turn off 'Use mouse input' on the Touch object and code touch and mouse input separately.

  • Ashley - I know it's doable that way, but then all the code for left clicking has to duplicated, and if any bugs are found, then they need to be fixed twice. If this was implemented, it would be one set of code to maintain.

  • What about:

    if (not mouse left click)

        turn off Mouse Input

    else

        turn it on

    Could this work?

  • Not really - it still requires two sets of code for registering mouse and touch triggers.

  • Arima - if you use OR blocks or functions, doesn't that eliminate any duplicate code?

  • Why not just use buttons for everything?

  • Ashley - An or block runs the conditions and actions of the event twice. Also, I thought there was some sort of restriction on or blocks preventing them from having subevents - but that doesn't seem to be the case anymore - was that changed at some point or am I remembering wrong?

    newt - because some games require input methods other than buttons?

  • Also, grabbing parameters from the touch object in a function called by the touch event doesn't seem to work. I suppose I could set them as parameters, but it just seems kind of clumsy in comparison, because then it's kind of hard to remember sometimes what value is set to what parameter and I have to keep looking it up. It also fragments the code tree and forgets picking.

    I'd also like to be able to name parameters, but I seem to remember there was a reason you didn't want to do that, though I don't remember what it was. But I'll cast my vote for them anyway. ^^

  • OR blocks definitely don't run the actions twice, if they do that's a bug! They should also be working fine with subevents, I don't believe there was ever a limitation with that.

  • Found out what was causing the problem - I forgot to turn off 'use mouse input' in the touch properties, so the or block was running twice. Turning it off made it work properly. Should I file a bug report for that? It seems kind of logical now that I think about it, since the mouse and touch plugins were both registering the mouse click. At least it was simple.

    So yeah, I guess using an or block is fine, and my request is unnessecary. Sorry for the trouble and thanks for the help!

    I have no idea where I got the idea that subevents couldn't be used under or blocks though... Maybe misremembering something about how picking works when there are two conditions for the same object in an or block. :/

  • Ashley - It didn't work as well as I thought it would. Example:

    On left click or touch start

    • set sprite position to touch.x touch.y

    If I left click, it places the sprite at 0, 0. This puts me back in the same position of needing two sets of code for the mouse and touch plugins.

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