Preferred touch object type ?

Discussion and feedback on Construct 2

Post » Sat Aug 10, 2013 10:51 pm

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!
B
44
S
14
G
60
Posts: 1,795
Reputation: 36,388

Post » Sat Aug 10, 2013 10:53 pm

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 ?
B
44
S
14
G
60
Posts: 1,795
Reputation: 36,388

Post » Sat Aug 10, 2013 11:06 pm

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.
B
57
S
15
G
11
Posts: 912
Reputation: 12,596

Post » Sat Aug 10, 2013 11:40 pm

Thanks for the help! Also, just to confirm, the touch action on a sprite object will suffice to allow tapping on a mobile app?
B
44
S
14
G
60
Posts: 1,795
Reputation: 36,388

Post » Sat Aug 10, 2013 11:42 pm

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.
B
57
S
15
G
11
Posts: 912
Reputation: 12,596

Post » Sat Aug 10, 2013 11:51 pm

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!
B
44
S
14
G
60
Posts: 1,795
Reputation: 36,388

Post » Wed Aug 14, 2013 11:45 am

To avoid them being clicked whilst not visible you can move them out of view or destroy & recreate
B
10
S
2
G
1
Posts: 77
Reputation: 1,278


Return to Construct 2 General

Who is online

Users browsing this forum: Ethan, Pulstar and 1 guest