cocos2d 版本 1.0.1 xcode 4.6.2 iphone 6.1 模拟器部署目标4.3
我为我的游戏编写了简单的代码,当我触摸精灵时,我试图让精灵向左移动 10 点。问题是当我触摸精灵时它向左移动并且精灵边界框向下移动,即精灵在-x 轴上移动但精灵边界框在-y 轴上移动。请帮我解决这个问题我不知道如果坐标系或设备方向设置有问题
-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint touchLocation = [touch locationInView:[touch view]];
CCSprite *mysprite = (CCSprite*)[self getChildByTag:1];
if (CGRectContainsPoint([mysprite boundingBox], touchLocation)) {
[mysprite runAction:[CCMoveBy actionWithDuration:1 position:ccp(-10,0) ]];
}
}