Added toggling map via 'm'

This commit is contained in:
Dominik Moritz Roth 2022-06-20 23:11:47 +02:00
parent 4bfa15b362
commit fe6cb991dd

View File

@ -7,8 +7,8 @@ from observables import Observable, CnnObservable
def main(): def main():
env = ColumbusTest3_1() #env = ColumbusTest3_1()
env = ColumbusTestRay(hide_map=True) env = ColumbusEasyObstacles(fps=30)
env.start_pos = [0.6, 0.3] env.start_pos = [0.6, 0.3]
playEnv(env) playEnv(env)
env.close() env.close()
@ -17,15 +17,22 @@ def main():
def playEnv(env): def playEnv(env):
env.reset() env.reset()
done = False done = False
to = 0
while not done: while not done:
t1 = time() t1 = time()
env.render() env.render()
pos = (0.5, 0.5) pos = (0.5, 0.5)
for event in pygame.event.get(): for event in pygame.event.get():
pass pass
# if event.type == pygame.MOUSEBUTTONDOWN: keys = pygame.key.get_pressed()
# pos = pygame.mouse.get_pos() if to == 0:
# print(pos) 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 = pygame.mouse.get_pos()
pos = (min(max((pos[0]-env.joystick_offset[0]-20)/60, 0), 1), 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)) min(max((pos[1]-env.joystick_offset[1]-20)/60, 0), 1))