Detect falling before bonus screen reset
This commit is contained in:
parent
d6cf4c1505
commit
cf4842e124
1 changed files with 6 additions and 3 deletions
|
@ -565,6 +565,11 @@ local function mainLoop(_M, genome)
|
||||||
timeoutConst = config.NeatConfig.TimeoutConstant
|
timeoutConst = config.NeatConfig.TimeoutConstant
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local fell = game.fell()
|
||||||
|
if fell then
|
||||||
|
_M.timeout = 0
|
||||||
|
end
|
||||||
|
|
||||||
if _M.currentFrame%5 == 0 then
|
if _M.currentFrame%5 == 0 then
|
||||||
local inputs, inputDeltas = game.getInputs()
|
local inputs, inputDeltas = game.getInputs()
|
||||||
if game.bonusScreenDisplayed(inputs) and _M.timeout > -1000 and _M.timeout < timeoutConst then
|
if game.bonusScreenDisplayed(inputs) and _M.timeout > -1000 and _M.timeout < timeoutConst then
|
||||||
|
@ -621,11 +626,9 @@ local function mainLoop(_M, genome)
|
||||||
message(_M, string.format("We missed %d frames", frame - lastFrame), 0x00990000)
|
message(_M, string.format("We missed %d frames", frame - lastFrame), 0x00990000)
|
||||||
end
|
end
|
||||||
|
|
||||||
local fell = game.fell()
|
|
||||||
|
|
||||||
-- Continue if we haven't timed out
|
-- Continue if we haven't timed out
|
||||||
local timeoutBonus = _M.currentFrame / 4
|
local timeoutBonus = _M.currentFrame / 4
|
||||||
if not fell and _M.timeout + timeoutBonus > 0 then
|
if _M.timeout + timeoutBonus > 0 then
|
||||||
return mainLoop(_M, genome)
|
return mainLoop(_M, genome)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue