]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
ortho follows cat, bobshouse can be opened
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 20 Oct 2016 13:23:52 +0000 (09:23 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 20 Oct 2016 13:23:52 +0000 (09:23 -0400)
main.cpp
src/world.cpp
xml/!town.xml
xml/bobshouse.xml

index 4b579b25ee88a5c249ee6f6c75efa8697de12f5c..7a4f0caaae9c502052f222138b246b31168cc4df 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -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)
index 15fde50c2138d0432234ea76ab508ed9e4106702..6405382fa516429ffd0d382c8a35f744744f4e17 100644 (file)
@@ -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());
                }
index bfaa6a9c358b9b0f6496b4544e693e70352cc6a9..0530762ff5662017d34e748ed664e2a0873e7895 100644 (file)
@@ -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>
 
index a1d4e7cc68450537c61170c04a9eeebdea739681..41ca907b384f0ccaf426f997e8220584f6edfb0e 100644 (file)
@@ -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>