Cocos2D v2.0至v3.x简洁转换指南(二)
发布时间:2020-12-14 16:37:35 所属栏目:百科 来源:网络整理
导读:触摸处理 我们在稍后将完成Cocos2d 3.0中触摸处理的完整教程。而现在最重要的是知道如何去启用触摸处理在你的CCNode中: self .userInteractionEnabled = TRUE ; 去捕捉一个触摸以及触摸的位置: - ( void )touchBegan:(UITouch *)touch withEvent:(UIEvent
触摸处理 我们在稍后将完成Cocos2d 3.0中触摸处理的完整教程。而现在最重要的是知道如何去启用触摸处理在你的CCNode中: self.userInteractionEnabled = TRUE;
去捕捉一个触摸以及触摸的位置: - (void)touchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
CGPoint touchLocation = [touch locationInNode:self];
// put your touch handling code here
}
并且知道3个其它方法,它们可以完成确定移动,结束和取消的触摸动作: - (void)touchMoved:(UITouch *)touch withEvent:(UIEvent *)event - (void)touchEnded:(UITouch *)touch withEvent:(UIEvent *)event - (void)touchCancelled:(UITouch *)touch withEvent:(UIEvent *)event
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |