【发布时间】:2012-02-03 13:11:03
【问题描述】:
我正在尝试使用 ccTouchesBegan 使精灵跳跃并使用 ccTouchesMoved 移动。当我使用 Touchesbegan 时它会跳跃但是当我尝试使用 TouchesMoved 移动精灵时,它会移动但也会跳跃。如何解决问题?请帮忙。
【问题讨论】:
-
如果你能展示你的方法,那将更容易回答这个问题。
-
@Override public boolean ccTouchesBegan(MotionEvent e) { CGSize winSize = CCDirector.sharedDirector().displaySize(); //CGPoint p = CCDirector.sharedDirector().convertToGL(CGPoint.ccp(e.getX(), e.getY())); hero.runAction(CCJumpTo.action(.2f, hero.getPosition(), 50, 1));返回 CCTouchDispatcher.kEventHandled; }
-
@Override public boolean ccTouchesMoved(MotionEvent e){ CGSize winSize = CCDirector.sharedDirector().displaySize(); CGPoint p = CCDirector.sharedDirector().convertToGL(CGPoint.ccp(e.getX(), e.getY())); hero.setPosition(CGPoint.ccp(p.x, p.y));返回 CCTouchDispatcher.kEventHandled; }
-
请用一些代码编辑您的问题,我无法帮助您查看它
标签: android cocos2d-iphone touch cocos2d-android