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

Isometric problem How to make character on top of tile

$
0
0

@Meir_yanovich wrote:

Hello ,
i have simple isometric map i build in tiled .
Map size is 20x20
Tile width 64
Tile Height 32
it contains 3 layers
the base ground layer 1 , cc_vertexz = -1000 , name : "ground" .
the button squares is layer 2 , cc_vertexz = automatic , name : "base"
the squares which are second raw is layer 3 , cc_vertexz = 1 , name : "base_on"
don't know why 1 but without it it doesn't show

i have character which i want to place on top of the squares marked 1 and 2 in the attached image :

This is the code to place the character ,

auto map = TMXTiledMap::create("level1_fix_map20.tmx");
	TMXLayer* baseLayer =  map->getLayer("base");
	int mapChildrenSize  = (int)map->getChildren().size();
	map->addChild(pGirl, mapChildrenSize);
	addChild(map, 0, 1);
	pGirl->retain();

	Vec2 v = baseLayer->getPositionAt(Vec2(11, 19));
	pGirl->setPosition(v);	 
	pGirl->setAnchorPoint(Vec2(0.5f, 0));
	auto s = map->getContentSize();
	map->setPosition(Vec2(0, 0));

	// all tiles are aliased by default, let's set them anti-aliased
	for (const auto& child : map->getChildren())
	{
		static_cast<SpriteBatchNode*>(child)->getTexture()->setAntiAliasTexParameters();
	}

How do i place it on top of the square tiles 1 and 2 ?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17071

Trending Articles



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