From 7c00fd6a34f409aed3781d6d6545498cea967589 Mon Sep 17 00:00:00 2001 From: zhangbin Date: Mon, 18 Jul 2016 10:35:59 +0800 Subject: [PATCH] Solve the error effect when using hex map with stagger-axis is x. --- native/cocos/2d/CCTMXLayer.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/native/cocos/2d/CCTMXLayer.cpp b/native/cocos/2d/CCTMXLayer.cpp index d7cb23c2f4..707fd16004 100644 --- a/native/cocos/2d/CCTMXLayer.cpp +++ b/native/cocos/2d/CCTMXLayer.cpp @@ -172,19 +172,7 @@ void TMXLayer::setupTiles() { for (int x=0; x < _layerSize.width; x++) { - int newX = x; - // fix correct render ordering in Hexagonal maps when stagger axis == x - if (_staggerAxis == TMXStaggerAxis_X && _layerOrientation == TMXOrientationHex) - { - int one_or_zero = (_staggerIndex == TMXStaggerIndex_Odd) ? 1 : 0; - int zero_or_one = one_or_zero ^ 1; - if (x >= (int)_layerSize.width/2) - newX = (x - (int)_layerSize.width/2) * 2 + one_or_zero; - else - newX = x * 2 + zero_or_one; - } - - int pos = static_cast(newX + _layerSize.width * y); + int pos = static_cast(x + _layerSize.width * y); int gid = _tiles[ pos ]; // gid are stored in little endian. @@ -196,7 +184,7 @@ void TMXLayer::setupTiles() // FIXME:: gid == 0 --> empty tile if (gid != 0) { - this->appendTileForGID(gid, Vec2(newX, y)); + this->appendTileForGID(gid, Vec2(x, y)); } } }