Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17083

Tiled : how to get object x,y?

$
0
0

@siskax07 wrote:

Hi again,

I'm just getting started with Cocos2d-x and Tiled, and I'm stuck trying to get the x and y values of my playerSpawn object that I defined in the objects layer in Tiled. I want to use them to set the position of the player.

This is what I have :

_objGroup = _tileMap->getObjectGroup("objs");
_objMap= _objGroup->getObject("playerSpawn");
_x = _objMap.at("x");
_y= _objMap.at("y");

_x and _y are Values ... So how do I convert them to int ? I tried .asInt(), but I get an error for that ...

I'm using : VS2015 on Win10, Cocos2d-x 3.8, c++

Thanks !

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>