Fixing minor timing error
This commit is contained in:
parent
f644f0ab52
commit
795dee588c
3
main.go
3
main.go
@ -253,6 +253,7 @@ restart:
|
||||
game.update()
|
||||
game.draw()
|
||||
if game.collision() {
|
||||
time.Sleep(1 * time.Second)
|
||||
fmt.Printf("\033[2J\033[10;%dHGame Over",max_cols/2-6)
|
||||
fmt.Printf("\033[11;%dHDepth: %d ft.",max_cols/2-8, game.tick * 6)
|
||||
fmt.Printf("\033[13;%dHR To Restart",max_cols/2-7)
|
||||
@ -266,7 +267,7 @@ restart:
|
||||
}
|
||||
}
|
||||
newtime := time.Now().UnixNano() / 1000000
|
||||
if dt := newtime - oldtime; dt < 60 && dt >= 0 {
|
||||
if dt := newtime - oldtime; dt < 100 && dt >= 0 {
|
||||
diff := time.Duration(100 - dt)
|
||||
time.Sleep(diff * time.Millisecond)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user