1. Introduce
Cocos2d for us to provide a good joystick controller, mainly for the ZJoystick.h and ZJOYSTICK.M add to achieve the following diagram function. You can control the movement of the sprite in the diagram by using a joystick. (But there is still a technical problem to be solved, that is, the sprite will be moved after a shadow left in the original position)
2. The realization of the rocker pole
1 The resources of the Zjoystick folder added to the project (below the page to provide download address), the wizard to add and move the previous said, do not know students can see the tutorial four. Project name is controlwalking
2) Modify the HelloWorldLayer.h file. Add some of the required node parameters.
#import <GameKit/GameKit.h>
//When your import this file, you import the cocos2d classes
#import "Cocos2 D.h "
#import" ZJoystick.h "
//Helloworldlayer
@interface helloworldlayer:cclayer<zjoystickdelegate >
{
cctexture2d *spritetexture_; Weak ref
//b2world* world; Strong ref
//glesdebugdraw *m_debugdraw; Strong ref
//cctmxtiledmap *_gamemap;
Ccsprite *_player;//is a genie, the panda in the picture is
//Returns a ccscene that contains the Helloworldlayer as the only child
+ (Ccscene *) scene;
@end
Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/