diff --git a/Levels/ObjectSetups/Compositions.xml b/Levels/ObjectSetups/Compositions.xml
index 7792f76..14e78d0 100644
--- a/Levels/ObjectSetups/Compositions.xml
+++ b/Levels/ObjectSetups/Compositions.xml
@@ -1,7 +1,7 @@
-
+
20
false
@@ -415,7 +415,7 @@
0.0
0.0
1.5
- 0.0
+ 100.0
diff --git a/application.cc b/application.cc
index b16e9c0..e4539a7 100644
--- a/application.cc
+++ b/application.cc
@@ -14,7 +14,8 @@ void Application::init()
std::srand(std::time(NULL));
// choose Level TODO: Choose this in a menu
std::string heightmapFilePath = heightmapPath + "heightmapLvl1.png";
- this->level = Level(heightmapFilePath);
+ std::string levelXmlFilePath = levelXmlPath + "Level1.xml";
+ this->level = Level(heightmapFilePath, levelXmlFilePath);
level.getPhysics()->init(geometryPath);
// Don't change this!
ignoredMouseUpdates = 0;
@@ -31,7 +32,7 @@ void Application::init()
// load Level
level.load();
Loader loader = Loader();
- std::string levelXmlFilePath = levelXmlPath + "Level1.xml";
+
loader.load(levelXmlFilePath, &level, compositionsPath, scriptPath);
graphics.init(&level);
diff --git a/level.cc b/level.cc
index bb3b82c..3437f42 100644
--- a/level.cc
+++ b/level.cc
@@ -1,11 +1,13 @@
#include "level.hh"
+#include "loader.hh"
#include
-Level::Level(std::string heightmapFilePath){
+Level::Level(std::string heightmapFilePath, std::string xmlFilePath){
this->terrain = Terrain(heightmapFilePath);
// default value
skydomeSize = 50.0f;
physics = Physics();
+ this->xmlFilePath = xmlFilePath;
}
Level::Level() {
@@ -162,6 +164,12 @@ void Level::deleteObject(int objectIndex){
}
}
+void Level::resetPlayer(){
+ Loader loader = Loader();
+ glm::vec3 newPosition = loader.reloadPlayerPosition(xmlFilePath, this);
+ //TODO cameraCenter.setPosition(newPosition);
+}
+
void Level::setStrength(float strength) {
this->strength = strength;
}
diff --git a/level.hh b/level.hh
index 69b3412..4cbdf34 100644
--- a/level.hh
+++ b/level.hh
@@ -20,7 +20,7 @@ extern "C" {
class Level {
public:
- Level(std::string heightmapFilePath);
+ Level(std::string heightmapFilePath, std::string xmlFilePath);
Level();
~Level();
void load();
@@ -55,6 +55,7 @@ class Level {
void addTrigger(Trigger trigger);
lua_State* getLuaState();
Terrain* getTerrain();
+ void resetPlayer();
private:
lua_State* luaState=nullptr;
std::vector