From dfae5ac251994a3f25f7473197f716148374e7ca Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 21 Mar 2022 13:42:51 -0400 Subject: player starts in the middle of first chunk now --- .../UserInterfaceState.xcuserstate | Bin 44765 -> 44765 bytes src/game.cpp | 4 ++-- src/game.h | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/macOS/Ether.xcodeproj/project.xcworkspace/xcuserdata/hatkirby.xcuserdatad/UserInterfaceState.xcuserstate b/macOS/Ether.xcodeproj/project.xcworkspace/xcuserdata/hatkirby.xcuserdatad/UserInterfaceState.xcuserstate index b700661..41171da 100644 Binary files a/macOS/Ether.xcodeproj/project.xcworkspace/xcuserdata/hatkirby.xcuserdatad/UserInterfaceState.xcuserstate and b/macOS/Ether.xcodeproj/project.xcworkspace/xcuserdata/hatkirby.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/src/game.cpp b/src/game.cpp index edc1605..b5d667a 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -26,9 +26,9 @@ Game::Game(std::mt19937& rng, Muxer& muxer, Renderer& renderer) : tick(); tick(); - for (int y = -1; y <= 1; y++) + for (int y = player_y-1; y <= player_y+1; y++) { - for (int x = -1; x <= 1; x++) + for (int x = player_x-1; x <= player_x+1; x++) { map.tile(x,y) = Tile::Floor; } diff --git a/src/game.h b/src/game.h index ae5f157..f46eb49 100644 --- a/src/game.h +++ b/src/game.h @@ -94,10 +94,10 @@ public: int ticksNeeded = 0; Timer gradualTickTimer = {100}; - int player_x = 0; - int player_y = 0; - int player_oldx = 0; - int player_oldy = 0; + int player_x = CHUNK_WIDTH/2; + int player_y = CHUNK_HEIGHT/2; + int player_oldx = player_x; + int player_oldy = player_y; bool renderPlayer = true; Animation playerAnim {Runtime::getResourcePath("player_anim.txt")}; -- cgit 1.4.1