Reputation: 778
I have looked all over the internet 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!
Upvotes: 2
Views: 952
Reputation: 4041
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];
Upvotes: 1