-1

I wanted to follow a tile map game tutorial for Cocos2D:

http://www.raywenderlich.com/29458/how-to-make-a-tile-based-game-with-cocos2d-2-x

However, it seems I can't follow this with Cocos2D 3.0 as the new Cocos2D doesn't seem to even include CCTMXLayer and CCTMXTiledMap.

I suppose I could install an older version of Cocos2D, but that could open a whole new can of worms. Is there some up to date tutorial or system for tile map games?

Thanks

user339946
  • 5,961
  • 9
  • 52
  • 97
  • hi..did you get working v3 tileMap sample ? please check this and answer https://stackoverflow.com/questions/52019991/cocos2dx-3-17-tilemap-basic-sample-wrong-tilecord-position – Guru Sep 01 '18 at 17:32

2 Answers2

1

Found a similar question with up to date version of Cocos2D objects: "How To Make a Tile-Based Game with Cocos2D 2.X" Make this tutorial with cocos2d V3

Community
  • 1
  • 1
user339946
  • 5,961
  • 9
  • 52
  • 97
0

for example: 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());