What is the best way to code a D-Pad in Cocos2d?
I have looked all over the int开发者_运维问答ernet for this. I was wondering what would be the best way to code a D-Pad that moves a character around the screen? This would be extremely helpful if someone answered. Thanks!
to get the joystick, google SneakyInput. its then a case of responding to the direction changes, and either moving the camera, or the character.
CGPoint scaledVelocity= ccpMult(sneakyInputJoystick.velocity, 480.0f);
CGPoint newPosition = ccp(aNode.position.x + scaledVelocity.x * deltaTime, tempNode.position.y + scaledVelocity.y * deltaTime);
[aNode setPosition:newPosition];
I personally like this better.
Cocos2D UI
精彩评论