ZJoystick is an iOS component designed to provide developers a ready made joystick they can use in their game apps. It mimics the actual joystick control that are used in games -mostly arcade games-.

ZJoystick is built using Cocos2D and is compatible to both iPhone and iPad.

How does ZJoystick work?

ZJoystick simply needs Sprites to represent Joystick container (Normal and Selected), the joystick control (joystick thumb) and the controlled object (sprite to move). ZJoystick also has options to set delegates, speed ratio and joystick radius.

Normal Sprite - embodies the joystick rest state (normal mode) which means that the joystick is not yet used.

Selected Sprite - embodies the josytick active state (selected mode) which means that the joystick is now being used.

Controller sprite (thumb) - Embodies the joystick controller (thumb) which moves inside the Joystick container that defines the direction of the controlled object (the sprite to move using joystick).

Speed Ratio - Determines the speed of the controlled object when controlled by joystick to any direction. This speed varies when the joystick conroller (thumb) varies its distance from the center of the joystick container.

Joystick Radius - This is the radius of revolution of the Joystick Thumb (joystick controller) around the center of Joystick Container (is often the radius of the Joystick Container sprite).

Joystick Tag - This is used within this protocol method -(void)joystickControlDidUpdate:(id)joystick toXSpeedRatio:(CGFloat)xSpeedRatio toYSpeedRatio:(CGFloat)ySpeedRatio to identify which joystick is controlling.

ZJoystick has three delegate methods that gets called everytime joystick get controlled.