您当前的位置: 首页 > 

Cocos2D v2.0至v3.x简洁转换指南(二)

发布时间:2015-10-13 20:56:01 ,浏览量:0

触摸处理

我们在稍后将完成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
关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    108697博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.1547s