diff --git a/build/BeagleRescue b/build/BeagleRescue index 08a39da..70f25c0 100755 Binary files a/build/BeagleRescue and b/build/BeagleRescue differ diff --git a/src/ecs/TileMapComponent.h b/src/ecs/TileMapComponent.h index 9750bd0..cd246c8 100644 --- a/src/ecs/TileMapComponent.h +++ b/src/ecs/TileMapComponent.h @@ -34,7 +34,7 @@ public: // std::tuple oPosition; std::vector> initialPositions; // std::array destRects; - int totalTiles; + int tileSetTotal; TileMapComponent() = default; @@ -51,9 +51,9 @@ public: setTex(map.tilesetCollection[0].name); globalScale = gScale; // =========== Setup Tile Set =========== - totalTiles = map.tilesetCollection[0].colCount*map.tilesetCollection[0].rowCount; -// std::cout << "Number of Tiles: " << totalTiles << std::endl; - tileSet.resize(totalTiles); + tileSetTotal = map.tilesetCollection[0].colCount*map.tilesetCollection[0].rowCount; +// std::cout << "Number of Tiles: " << tileSetTotal << std::endl; + tileSet.resize(tileSetTotal); for (int r=0;r ogPos = std::make_tuple(thisRect.x,thisRect.y); initialPositions[elem] = ogPos; + thisRect.x = thisRect.x-offsetX*globalScale; + thisRect.y = thisRect.y-offsetY*globalScale; destRects[elem] = thisRect; // std::cout << "destRects[" << elem << "].x = " << destRects[elem].x << "].y = " << destRects[elem].y << "].w = " << destRects[elem].w << std::endl; } diff --git a/src/game/Game.cpp b/src/game/Game.cpp index ae537d5..48cae6c 100644 --- a/src/game/Game.cpp +++ b/src/game/Game.cpp @@ -341,14 +341,14 @@ void Game::update() pVel.x = player.getComponent().velocity.x; pVel.y = player.getComponent().velocity.y; -// if(camera.x < 0) -// camera.x = 0; -// if (camera.y < 0) -// camera.y = 0; -// if (camera.x > levelMap.w-camera.w*1.5-player.getComponent().width) -// camera.x = levelMap.w-camera.w*1.5-player.getComponent().width; -// if (camera.y > levelMap.h-camera.h*1.5-player.getComponent().height) -// camera.y = levelMap.h-camera.h*1.5-player.getComponent().height; + if(camera.x < 0) + camera.x = 0; + if (camera.y < 0) + camera.y = 0; + if (camera.x > levelMap.w-camera.w) + camera.x = levelMap.w-camera.w; + if (camera.y > levelMap.h-camera.h) + camera.y = levelMap.h-camera.h; if (Game::debugCollisionBoxes) { for (auto& c: colliders)