Preferred touch object type ?

  • Hi,

    I'm currently making a game with a lot of clicking (or hopefully touching on a mobile). I am currently using sprite objects that, when touched, will trigger certain events. However I am having trouble disabling sprites. I see that you are able to disable buttons. What I would like to know is if I go ahead and make it for mobile would clicking a button be the same as touching a sprite object on a touchscreen? I don't want to go through the entire game using buttons only to find out they can't be touched, only clicked in a windows game.

    Thanks!

  • Actually I have just realised that buttons don't work while invisible so they're no good anyway. Any tips on how to disable the touching of sprite objects to avoid spam ?

  • If you're planning to export with CocoonJS (and Intel XDK too, I believe), the button object isn't supported, so you'll have to use sprites anyway.

    When you say spam, do you mean click-spamming? To prevent this, give each sprite a timer that is activated upon each click, and only allow clicks once that timer has expired: use the Compare two values condition in the On touched object event, and check if the expression Sprite.Timer.CurrentTime("AntiSpam") is equal to 0.

  • Thanks for the help! Also, just to confirm, the touch action on a sprite object will suffice to allow tapping on a mobile app?

  • Yup.

    Also, just in case you hadn't noticed, the touch object can emulate the mouse object as well (it's enabled by default) - useful for testing mobile apps on desktop.

  • Cool. Yep I wasn't thinking clearly, the way I've done it is On Touch,When Int=0, Set Int to 1, Do Event, Set Int to 0. Thanks for the help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To avoid them being clicked whilst not visible you can move them out of view or destroy & recreate

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