cocos2d 子类化精灵来处理触摸? [英] cocos2d subclassing sprite to handle touch?

查看:29
本文介绍了cocos2d 子类化精灵来处理触摸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 cocos2d(-x) 世界的新手.

I'm new to the cocos2d(-x) world.

我想检测精灵的触摸,教程/示例似乎建议使用层来检测触摸并找到带有边界框的适当精灵.

I'd like to detect a touch to a sprite, and tutorials/examples seem to suggest using layer to detect touch and find the approapriate sprite with bounding box.

子类化精灵以允许触摸检测通常是个坏主意吗?

Is subclassing sprite to allow touch detection generally a bad idea?

推荐答案

在一个地方处理触摸会更好,更清晰.但我认为,没有人可以阻止你这样做

it is better and much more clear to handle touches in one place. but i think, no one can bar you to do this

这篇关于cocos2d 子类化精灵来处理触摸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆