Just wanted to know if it would be possible to detect and execute code when player swipes up on a particular part of the screen. For example when the user swipes up on the right hand side of my game it would start the game. [import]uid: 6134 topic_id: 27608 reply_id: 327608[/import]
Sure, there are a couple of different options.
-
You could have a touch event on the whole screen and in the event handler and see if event.x and event.y are in the area you want it, if not ignore the swipe.
-
Create an invisible rectangle that is your hit target. Set it’s .isHitTestable property to true and add a touch handler to the invisible target.
[import]uid: 19626 topic_id: 27608 reply_id: 112110[/import]
So what you are saying is for my purposes I can create an invisible shape and when the user click any where on that shop it executes code ? [import]uid: 6134 topic_id: 27608 reply_id: 112417[/import]
Yep. [import]uid: 19626 topic_id: 27608 reply_id: 112421[/import]