Is there an easy way to do the following?
I want to split a view into 4 via two diagonal lines:
So the upper triangle area will correspond to "up". The other 3 will correspond to "left", "down", "right" respectively.
What would be the easiest or the most efficient way of doing this? I had considered creating 4 triangle shapes and detecting touches inside them, but maybe this will be unnecessary?
Context: For moving a sprite in a map.
Thanks!
After my comment, I wanted to mock up a simple implementation for myself, so, here's a simple full screen joystick that will determine cardinal-like directions based on touch position relative to the center of the screen.
(FullScreenJoystick)
I'm still using cocos2d-iphone 1.1 , so.. I'm not sure if there are any mods necessary for v2
FSJoy.h
FSJoy.m
Usage is simply to add the Joystick to the scene/layer:
FSJoyTest.h
FSJoyTest.m