Is there any way to increase the the touch area for example if i touched the Iphone i want the touch detection area to increase and affect nearby sprites.and handle them as if they were touched too.
increase touch area
(4 posts) (2 voices)-
Posted 2 years ago #
-
There isn't anything defined as "touch area" on any CocosNode if it doesn't explicitly handle touches (like menu items, etc...). So you're the one deciding what should touch do.
For example:
- If you want your menu item to have larger area for touch, you can set menu item's contentSize to bigger one.
- If you're subclassing CocosNode to handle touches, then you should have some "rect" method defining the exact area where touches should be handled
- Similar thing when you're detecting touches on whole layer...Check TouchesTest to see how to handle touches on subclassed nodes...
Posted 2 years ago # -
hmm - If you want your menu item to have larger area for touch, you can set menu item's contentSize to bigger one.
i think i am going to try that as i am already using this to detect touches on subclassed AtlasSprite
thanks alot
Posted 2 years ago # -
Well, not sure that's the best method to handle touches on AtlasSprite. Maybe there are other methods that use contentSize for something, so you're risking changing that. Why don't you just look that "TouchesTest" I suggested and see how to properly handle touches on AtlasSprite or any other CocosNode?
Posted 2 years ago #
Reply
You must log in to post.