diff --git a/data/levels/Level1.xml b/data/levels/Level1.xml
index f48c5b2..03f01d1 100644
--- a/data/levels/Level1.xml
+++ b/data/levels/Level1.xml
@@ -11944,7 +11944,7 @@
34
-
-
- 10
+ 2
false
0
sunStart.lua
@@ -11956,11 +11956,11 @@
sunUpdate
false
-216
- 20
+ 27.5
34
-
-
- 10
+ 12
false
0
sunUpdate.lua
diff --git a/data/levels/scripts/sunStart.lua b/data/levels/scripts/sunStart.lua
index c7865c0..f2d55fb 100644
--- a/data/levels/scripts/sunStart.lua
+++ b/data/levels/scripts/sunStart.lua
@@ -13,7 +13,7 @@ function trigger(objectToChange)
local time = os.clock()
global.sunStartTime = time
global.triggeredSunStart = true
-
+ level:activateEndgame()
print("sunStart")
end
end
diff --git a/data/levels/scripts/sunUpdate.lua b/data/levels/scripts/sunUpdate.lua
index 972c629..9160ad9 100644
--- a/data/levels/scripts/sunUpdate.lua
+++ b/data/levels/scripts/sunUpdate.lua
@@ -7,7 +7,7 @@ function trigger(objectToChange)
return
end
- local maxTimeDiff = 5
+ local maxTimeDiff = 20
local timeDiff = os.clock()- global.sunStartTime
if(timeDiff > maxTimeDiff)then
timeDiff = maxTimeDiff
diff --git a/level.cc b/level.cc
index 6ac2f8f..754aa5a 100644
--- a/level.cc
+++ b/level.cc
@@ -41,6 +41,7 @@ void Level::load() {
.addFunction("resetPlayer", &Level::resetPlayer)
.addFunction("movePlayer", &Level::movePlayer)
.addFunction("setSunDirection", &Level::setSunDirection)
+ .addFunction("activateEndgame", &Level::activateEndgame)
.endClass();
//Push the level to Lua as a global variable
luabridge::push(luaState, this);
@@ -272,3 +273,7 @@ Terrain* Level::getTerrain() {
Skydome* Level::getSkydome() {
return &skydome;
}
+
+void Level::activateEndgame(){
+ physics.activateEndgame();
+}
diff --git a/level.hh b/level.hh
index e18db48..f5979fd 100644
--- a/level.hh
+++ b/level.hh
@@ -61,6 +61,7 @@ class Level {
void resetPlayer();
void movePlayer(float xPosition, float yPosition, float zPosition);
void setPlayerIndex(int index);
+ void activateEndgame();
private:
lua_State* luaState=nullptr;
std::vector