-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
30 lines (23 loc) · 674 Bytes
/
test.py
File metadata and controls
30 lines (23 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Run a minimal manual gameplay test loop."""
import time
import cv2
import numpy as np
import game.World
from src import Config
from game.MazeGen import MazeGen
if __name__ == "__main__":
mazegen = MazeGen(20, 10)
world = game.World.World(mazegen, Config())
canvas = np.zeros((10 * 37, 20 * 37, 3), dtype=np.uint8)
last_frame_t = time.time()
while True:
world.update(last_frame_t)
last_frame_t = time.time()
world.draw(canvas)
cv2.imshow("Pacman", canvas)
key = cv2.waitKeyEx(1)
if key == ord("q"):
break
if key != -1:
world.on_key(key)
cv2.destroyAllWindows()