问题描述
- cocos2dx TilerMap 地图碰撞检测问题 新人求解
-
有一段简短代码求大牛给分析一下
auto listener = EventListenerTouchOneByOne::create();
listener->onTouchBegan = map,scenelayer,sprite{
Point point = map->convertToNodeSpace(touch->getLocation());
point.x = static_cast (point.x/32);
point.y = map->getMapSize().height - static_cast(point.y/32)-1;auto player= scenelayer->getTileAt(point);//获取触摸图块 auto gid = scenelayer->getTileGIDAt( point);//获取触摸图块ID log("%d", gid); cocos2d::ValueMap pro = map->getPropertiesForGID(gid).asValueMap();//加上这步后点击就出现了错误 我下面想通过获取属性来判断 这步就走不下去了 return false; }; Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, map); 错误信息提示 _type== Type::MAP 求解释一下 谢谢 谢谢
解决方案
http://blog.csdn.net/vanquishedzxl/article/details/22962325
时间: 2024-11-02 08:49:11