From fe6cb991dd7cb80de0ed95815cde13298be370c5 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Mon, 20 Jun 2022 23:11:47 +0200 Subject: [PATCH] Added toggling map via 'm' --- columbus/humanPlayer.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/columbus/humanPlayer.py b/columbus/humanPlayer.py index c2e6495..59041dd 100644 --- a/columbus/humanPlayer.py +++ b/columbus/humanPlayer.py @@ -7,8 +7,8 @@ from observables import Observable, CnnObservable def main(): - env = ColumbusTest3_1() - env = ColumbusTestRay(hide_map=True) + #env = ColumbusTest3_1() + env = ColumbusEasyObstacles(fps=30) env.start_pos = [0.6, 0.3] playEnv(env) env.close() @@ -17,15 +17,22 @@ def main(): def playEnv(env): env.reset() done = False + to = 0 while not done: t1 = time() env.render() pos = (0.5, 0.5) for event in pygame.event.get(): pass - # if event.type == pygame.MOUSEBUTTONDOWN: - # pos = pygame.mouse.get_pos() - # print(pos) + keys = pygame.key.get_pressed() + if to == 0: + to = int(env.fps/2) + if keys[pygame.K_m]: + env.draw_entities = not env.draw_entities + else: + to = 0 + else: + to -= 1 pos = pygame.mouse.get_pos() pos = (min(max((pos[0]-env.joystick_offset[0]-20)/60, 0), 1), min(max((pos[1]-env.joystick_offset[1]-20)/60, 0), 1))