cocos2d子类化精灵处理触摸? [英] cocos2d subclassing sprite to handle touch?
本文介绍了cocos2d子类化精灵处理触摸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是cocos2d(-x)世界的新手。
I'm new to the cocos2d(-x) world.
我想检测对sprite的触摸,教程/示例似乎建议使用图层来检测触摸,并找到具有边界框的适当sprite。
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.
子类化sprite是否允许触摸检测通常是一个坏主意?
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屋!
查看全文