我想关注Cocos2D的瓷砖地图游戏教程:
http://www.raywenderlich.com/29458/how-to-make-a-tile-based-game-with-cocos2d-2-x
然而,似乎我无法使用Cocos2D 3.0,因为新的Cocos2D似乎甚至不包含CCTMXLayer
和CCTMXTiledMap
。
我想我可以安装旧版本的Cocos2D,但这可能会打开一整套新蠕虫。是否有一些最新的瓷砖地图游戏教程或系统?
由于
答案 0 :(得分:1)
使用最新版本的Cocos2D对象发现了类似的问题: "How To Make a Tile-Based Game with Cocos2D 2.X" Make this tutorial with cocos2d V3
答案 1 :(得分:0)
例如: HelloWorldScene.h
cpp
// Inside the HelloWorld class declaration
cocos2d::Sprite *_player;
HelloWorldScene.cpp
cpp
// Inside the init method, after setting "_background ="
TMXObjectGroup *objects = _tileMap->getObjectGroup("Objects");
CCASSERT(NULL != objects, "'Objects' object group not found");
auto spawnPoint = objects->getObject("SpawnPoint");
CCASSERT(!spawnPoint.empty(), "SpawnPoint object not found");
int x = spawnPoint["x"].asInt();
int y = spawnPoint["y"].asInt();
_player = Sprite::create("Player.png");
_player->setPosition(x, y);
addChild(_player);
setViewPointCenter(_player->getPosition());