[ad_1]
Game Development Stack Exchange is a query and reply website for skilled and unbiased recreation builders. It solely takes a minute to enroll.
Anybody can ask a query
Anybody can reply
The greatest solutions are voted up and rise to the highest
Asked
Viewed
699 instances
I wish to set my sprite in x coordinate based mostly on an object in TMX map file,
that is my code:
tileMap = cocos2d::TMXTiledMap::create("floor.tmx");
floor = tileMap->layerNamed("floor");
this->addChild(tileMap);
TMXObjectGroup *objects = tileMap->objectGroupNamed("objects");
Dictionary *signal = (Dictionary*)objects->objectNamed("signal");
How am i able to get a price of object in tmx file in Cocos2d x ?
$endgroup$
ValueMap signal = objects->getObject("signal");
float x = signal["x"].asFloat();
float y = signal["y"].asFloat();
std::string nameAlias = signal["name_alias"].asString();
In cocos2d v.3.8, objectNamed(“title”) will return ValueMap kind that accommodates Value kind. You can see in CCValue.h for extra particulars.
$endgroup$
You should log in to reply this query.
Not the reply you are in search of? Browse different questions tagged cocos2d-iphone tilemap cocos2d-x .
default
[ad_2]