【发布时间】:2014-08-26 04:05:21
【问题描述】:
这里是事件句柄函数,self是cc.Node,self.bg是cc.Sprite
local function onTouchEnded(touch, event)
local location = touch:getLocation()
local size = self.bg:getContentSize()
local rect = cc.rect(self:getPositionX(),self:getPositionY(),size.width,size.height)
end
如何比较location和rect来检查这个精灵是否点击,我已经阅读了这个文档,
http://www.cocos2d-x.org/reference/native-cpp/V3.2/d4/d8a/classcocos2d_1_1_rect.html#a011e04551ca371f8a99d2a3f47cd499e
好像cc.rect 没有containsPoint 功能,有没有其他办法处理?
【问题讨论】: