Cocos2d-x加载TiledMap地图出现黑线问题

60 views

当前测试版本Cocos2d-x 3.1.7版本,采用传统的TMXTiledMap会出现问题黑线问题,尤其是人物跳转超出屏幕范围会出现横黑线闪烁,如图。

Black Line

网上有很多方法,都比较繁琐。我的最快的解决办法是直接将cocos2d::TMXTiledMap替换为cocos2d::experimental::TMXTiledMap,其它方法不变。
原来方法

cocos2d::TMXTiledMap *_tiledMap = TMXTiledMap::create(StringUtils::format("res/maps/Level-%d.tmx",1));
this->addChild(_tiledMap,0);

替换方法

cocos2d::experimental::TMXTiledMap *_tiledMap = TMXTiledMap::create(StringUtils::format("res/maps/Level-%d.tmx",1));
this->addChild(_tiledMap,0);

替换后效果图。
 

Black Line2

 

This entry was posted in cocos2d and tagged by Charlie. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>