added stop timer to add a delay after level end

This commit is contained in:
2024-02-13 18:15:52 +01:00
parent 5a288035b3
commit c9f8783521
6 changed files with 48 additions and 19 deletions

View File

@@ -6,6 +6,7 @@ import (
"openquell/components"
. "openquell/components"
"openquell/config"
. "openquell/config"
"openquell/observers"
"github.com/hajimehoshi/ebiten/v2"
@@ -70,10 +71,11 @@ func (system *CollectibleSystem) Update() {
}
if numcollectibles == 0 {
// winner, winner, chicken dinner!
game := observers.GetGameObserver(system.World)
game.Score++
game.CurrentLevel++
// winner, winner, chicken dinner!
timer := observers.GetGameObserver(system.World).StopTimer
if !timer.Running {
timer.Start(LEVEL_END_WAIT)
}
}
}