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)
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());
}
<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>
<?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>