瀏覽代碼

reset snake speed on restart

Thomas Buck 1 年之前
父節點
當前提交
4b49c4f200
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2
    1
      snake.py

+ 2
- 1
snake.py 查看文件

@@ -17,7 +17,7 @@ class Snake:
17 17
         self.gui = g
18 18
         self.input = i
19 19
         self.colors = [ bg, sc, d ]
20
-        self.timestep = ts
20
+        self.timestepOriginal = ts
21 21
         self.timeout = to
22 22
         self.speedup = su
23 23
 
@@ -35,6 +35,7 @@ class Snake:
35 35
         self.restart()
36 36
 
37 37
     def restart(self):
38
+        self.timestep = self.timestepOriginal
38 39
         self.start = time.time()
39 40
         self.last = time.time()
40 41
         self.direction = "r"

Loading…
取消
儲存