MCPcopy Create free account
hub / github.com/axmolengine/axmol / repositionSprite

Method repositionSprite

tests/cpp-tests/Source/TileMapTest/TileMapTest2.cpp:818–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

816}
817
818void TMXIsoZorderNew::repositionSprite(float dt)
819{
820 auto p = _tamara->getPosition();
821 p = AX_POINT_POINTS_TO_PIXELS(p);
822 auto map = getChildByTag(kTagTileMap);
823
824 // there are only 4 layers. (grass and 3 trees layers)
825 // if tamara < 48, z=4
826 // if tamara < 96, z=3
827 // if tamara < 144,z=2
828
829 int newZ = 4 - (p.y / 48);
830 newZ = std::max(newZ, 0);
831
832 map->reorderChild(_tamara, newZ);
833}
834
835std::string TMXIsoZorderNew::title() const
836{

Callers

nothing calls this directly

Calls 5

getChildByTagFunction · 0.85
maxFunction · 0.50
getPositionMethod · 0.45
reorderChildMethod · 0.45
setPositionZMethod · 0.45

Tested by

no test coverage detected