diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-10-20 09:23:52 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-10-20 09:23:52 -0400 |
commit | 7a4bc1d9e6b73471cb2e20d2ab0611a507979f30 (patch) | |
tree | 853f3b7e367259338b402aef6e1892f27ec04309 | |
parent | a7ec2350f406195b119e24a81c95649c3645a26b (diff) |
ortho follows cat, bobshouse can be opened
-rw-r--r-- | main.cpp | 9 | ||||
-rw-r--r-- | src/world.cpp | 46 | ||||
-rw-r--r-- | xml/!town.xml | 2 | ||||
-rw-r--r-- | xml/bobshouse.xml | 5 |
4 files changed, 11 insertions, 51 deletions
@@ -266,11 +266,14 @@ void render() { const auto SCREEN_WIDTH = game::SCREEN_WIDTH; const auto SCREEN_HEIGHT = game::SCREEN_HEIGHT; -// offset.x = player->loc.x + player->width / 2; + //offset.x = game::entities.Iterator.begin().component<Position>().x;// + player->width / 2; - auto worldWidth = game::engine.getSystem<WorldSystem>()->getWidth(); + game::entities.each<Position>([](entityx::Entity entity, Position &position) { + (void)entity; + offset.x = position.x; + }); - // ortho x snapping + auto worldWidth = game::engine.getSystem<WorldSystem>()->getWidth(); if (worldWidth < (int)SCREEN_WIDTH) offset.x = 0; else if (offset.x - SCREEN_WIDTH / 2 < worldWidth * -0.5f) diff --git a/src/world.cpp b/src/world.cpp index 15fde50..6405382 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -330,51 +330,7 @@ loadWorldFromXMLNoSave(std::string path) { newEntity = nullptr; name = wxml->Name(); - // world linkage - if (name == "link") { - - // links world to the left - if ((ptr = wxml->Attribute("left"))) { - tmp->setToLeft(ptr); - - // load the left world if it isn't - if (!loadedLeft) { - loadedRight = true; - currentWorldToLeft = loadWorldFromXMLNoSave(ptr); - loadedRight = false; - } else { - currentWorldToLeft = nullptr; - } - } - - // links world to the right - else if ((ptr = wxml->Attribute("right"))) { - tmp->setToRight(ptr); - - // load the right world if it isn't - if (!loadedRight) { - loadedLeft = true; - currentWorldToRight = loadWorldFromXMLNoSave(ptr); - loadedLeft = false; - } else { - currentWorldToRight = nullptr; - } - } - - // tells what world is outside, if in a structure - else if (Indoor && (ptr = wxml->Attribute("outside"))) { -// if (!loadedLeft && !loadedRight) -// inside.push_back(ptr); - } - - // error, invalid link tag - else { - UserError("XML Error: Invalid <link> tag in " + _currentXML + "!"); - } - - } - - // set spawn x for player + // set spawn x for player else if (name == "spawnx" && !(loadedLeft | loadedRight)) { player->loc.x = std::stoi(wxml->GetText()); } diff --git a/xml/!town.xml b/xml/!town.xml index bfaa6a9..0530762 100644 --- a/xml/!town.xml +++ b/xml/!town.xml @@ -7,7 +7,7 @@ <npc name="Sanc" hasDialog="true"/> <npc name="Bob" hasDialog="true" spawnx="30"/> <structure type="1" spawnx="300"/> - <structure inside="bobshouse.xml" insideTexture="assets/style/classic/bg/insideWoodHouse.png" type="1" spawnx="10"/> + <structure inside="bobshouse.xml" type="1" spawnx="10"/> <chest/> </World> diff --git a/xml/bobshouse.xml b/xml/bobshouse.xml index a1d4e7c..41ca907 100644 --- a/xml/bobshouse.xml +++ b/xml/bobshouse.xml @@ -1,8 +1,9 @@ <?xml version="1.0"?> <IndoorWorld> <style background="0" bgm="assets/music/theme_jazz.wav" folder="assets/style/classic/"/> - <house width="800"/> + <house width="800" texture="assets/style/classic/bg/insideWoodHouse.png" /> <generation width="1600"/> - <link outside="town.xml"/> + <time>6000</time> + <!--<link outside="town.xml"/>--> <npc name="Bob" hasDialog="false" spawnx="30"/> </IndoorWorld> |