Added lua scripts for the sunrise.
This commit is contained in:
parent
2dd09aff19
commit
0f7240b047
@ -2,6 +2,10 @@ local global = require( "global" )
|
||||
if(global.triggeredSCRIPTNAME == nil) then
|
||||
global.triggeredSCRIPTNAME = false
|
||||
end
|
||||
if(global.triggeredSCRIPTNAMEUndo == nil) then
|
||||
global.triggeredSCRIPTNAMEUndo = false
|
||||
end
|
||||
|
||||
function trigger(objectToChange)
|
||||
if(global.triggeredSCRIPTNAME == false) then
|
||||
if(not level) then
|
||||
@ -15,3 +19,17 @@ function trigger(objectToChange)
|
||||
print("SCRIPTNAME")
|
||||
end
|
||||
end
|
||||
|
||||
function triggerUndo(objectToChange)
|
||||
if(global.triggeredSCRIPTNAMEUndo == false) then
|
||||
if(not level) then
|
||||
print("No level found in Lua!")
|
||||
return
|
||||
end
|
||||
|
||||
--enter the scripts undo code here
|
||||
|
||||
global.triggeredSCRIPTNAMEUndo = true
|
||||
print("SCRIPTNAMEUndo")
|
||||
end
|
||||
end
|
||||
|
@ -2,12 +2,14 @@ local global = require( "global" )
|
||||
if(global.triggeredResetPlayer == nil) then
|
||||
global.triggeredResetPlayer = false
|
||||
end
|
||||
|
||||
function trigger(objectToChange)
|
||||
if(global.triggeredResetPlayer == false) then
|
||||
if(not level) then
|
||||
print("No level found in Lua!")
|
||||
return
|
||||
end
|
||||
|
||||
if(global.triggeredOpenFirstDoor == true) then
|
||||
if(global.openedSecondDoor == true) then
|
||||
if(global.triggeredOpenThirdDoor == true) then
|
||||
@ -22,7 +24,6 @@ function trigger(objectToChange)
|
||||
level:resetPlayer()
|
||||
end
|
||||
|
||||
--global.triggeredResetPlayer = true
|
||||
print("reset player")
|
||||
end
|
||||
end
|
||||
|
19
data/levels/scripts/sunStart.lua
Normal file
19
data/levels/scripts/sunStart.lua
Normal file
@ -0,0 +1,19 @@
|
||||
local global = require( "global" )
|
||||
if(global.triggeredSunStart == nil) then
|
||||
global.triggeredSunStart = false
|
||||
end
|
||||
|
||||
function trigger(objectToChange)
|
||||
if(global.triggeredSunStart == false) then
|
||||
if(not level) then
|
||||
print("No level found in Lua!")
|
||||
return
|
||||
end
|
||||
|
||||
local time = os.clock()
|
||||
global.sunStartTime = time
|
||||
global.triggeredSunStart = true
|
||||
|
||||
print("sunStart")
|
||||
end
|
||||
end
|
21
data/levels/scripts/sunUpdate.lua
Normal file
21
data/levels/scripts/sunUpdate.lua
Normal file
@ -0,0 +1,21 @@
|
||||
local global = require( "global" )
|
||||
|
||||
function trigger(objectToChange)
|
||||
if(global.triggeredSunStart) then
|
||||
if(not level) then
|
||||
print("No level found in Lua!")
|
||||
return
|
||||
end
|
||||
|
||||
local maxTimeDiff = 5
|
||||
local timeDiff = os.clock()- global.sunStartTime
|
||||
if(timeDiff > maxTimeDiff)then
|
||||
timeDiff = maxTimeDiff
|
||||
end
|
||||
timeDiff = timeDiff/maxTimeDiff
|
||||
local x = 1 - 0.3 * timeDiff
|
||||
local y = 0.7 * timeDiff
|
||||
local z = timeDiff^0.5 * 0.6 -0.1
|
||||
level:setSunAngle(x,y,z)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user