我是第一次接触cocos2d-android。我想在我的代码中使用触摸事件添加CCJumpTo。但我不知道该怎么解决它。请帮帮忙。
发布于 2012-02-03 21:08:52
覆盖CCLayer中的ccTouchesEnded并创建一个跳转到的点,如下所示
public boolean ccTouchesEnded(MotionEvent event) {
CGPoint touch = CCDirector.sharedDirector().convertToGL(
CGPoint.ccp(event.getX(), event.getY()));
CGSize winSize = CCDirector.sharedDirector().displaySize();
aHero.runAction(CCJumpTo.action(2f, touch , 100, 1));
return true;
}其中aHero是您想要跳转的精灵,它将使精灵跳一次到触摸的区域,并在2秒内到达那里,跳跃高度为100
https://stackoverflow.com/questions/9123918
复制相似问题