diff --git a/data/levels/Level1.xml b/data/levels/Level1.xml
index 82d3e92..307d580 100644
--- a/data/levels/Level1.xml
+++ b/data/levels/Level1.xml
@@ -12879,7 +12879,7 @@
34
-
-
- 10
+ 2
false
0
sunStart.lua
@@ -12891,11 +12891,11 @@
sunUpdate
false
-216
- 20
+ 27.5
34
-
-
- 10
+ 12
false
0
sunUpdate.lua
@@ -13088,7 +13088,7 @@
- 15
+ 14.5
skydomeNew.png
diff --git a/data/levels/scripts/resetPlayer.lua b/data/levels/scripts/resetPlayer.lua
index 6262557..4e24cf7 100644
--- a/data/levels/scripts/resetPlayer.lua
+++ b/data/levels/scripts/resetPlayer.lua
@@ -13,12 +13,12 @@ function trigger(objectToChange)
if(global.triggeredOpenFirstDoor == true) then
if(global.openedSecondDoor == true) then
if(global.triggeredOpenThirdDoor == true) then
- level:movePlayer(-169.5,22.5,58.5)
+ level:movePlayer(-169.5,21.5,58.5)
else
- level:movePlayer(-78.5,22.5,4.5)
+ level:movePlayer(-78.5,21.75,4.5)
end
else
- level:movePlayer(17.5,22.5,87.0)
+ level:movePlayer(17.5,21.0,87.0)
end
else
level:resetPlayer()
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/data/shader/skydome.fsh b/data/shader/skydome.fsh
index 7d3f4e2..68f52d2 100644
--- a/data/shader/skydome.fsh
+++ b/data/shader/skydome.fsh
@@ -14,7 +14,7 @@ uniform vec3 cameraCenter;
uniform vec3 sunColor;
uniform vec3 directionalVector;
-const float sunSize = 40.0;
+const float sunSize = 20.0;
void main() {
vec4 textureColor = vec4(0.0, 0.0, 0.0, 1.0);
diff --git a/data/shader/skydome.vsh b/data/shader/skydome.vsh
index 2dc7b65..0fa520e 100644
--- a/data/shader/skydome.vsh
+++ b/data/shader/skydome.vsh
@@ -17,6 +17,6 @@ out vec4 sunPosition;
void main() {
fragPosition = modelMatrix * vec4(aPosition, 1.0);
vTexCoord = aTexCoord;
- sunPosition = (normalize(vec4(directionalVector, 0.0)) * skydomeSize) + vec4(cameraCenter, 1.0);
+ sunPosition = (normalize(vec4(directionalVector, 0.0)) * skydomeSize) + vec4(cameraCenter.x, 0, cameraCenter.z, 1.0);
gl_Position = modelViewProjectionMatrix * vec4(aPosition, 1.0);
}
diff --git a/level.cc b/level.cc
index 6dee656..d0a4c3b 100644
--- a/level.cc
+++ b/level.cc
@@ -42,6 +42,7 @@ void Level::load() {
.addFunction("movePlayer", &Level::movePlayer)
.addFunction("setSunDirection", &Level::setSunDirection)
.addFunction("forceMove", &Level::forceMove)
+ .addFunction("activateEndgame", &Level::activateEndgame)
.endClass();
//Push the level to Lua as a global variable
luabridge::push(luaState, this);
@@ -278,3 +279,7 @@ void Level::forceMove(float x, float y, float z, unsigned indice){
glm::vec3 position = glm::vec3(x,y,z);
physics.forceMove(position, indice);
}
+
+void Level::activateEndgame(){
+ physics.activateEndgame();
+}
diff --git a/level.hh b/level.hh
index 4c4b382..f494211 100644
--- a/level.hh
+++ b/level.hh
@@ -62,6 +62,7 @@ class Level {
void movePlayer(float xPosition, float yPosition, float zPosition);
void setPlayerIndex(int index);
void forceMove(float x, float y, float z, unsigned indice);
+ void activateEndgame();
private:
lua_State* luaState=nullptr;
std::vector