From 28868e5451e9e242d09dae0d145cf59b8f10d4a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Mon, 8 Apr 2024 00:10:08 +0500 Subject: [PATCH] Add buttons to reset coordinates and angle. --- README.md | 2 ++ defaultcontrols.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index f6b0c85..68f6d95 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,5 @@ If no game is specified then "squareroom" will be loaded. | Print current position to the terminal | F4 | | Save level to `./levels` folder | F5 | | Snap to the closest point | F6 | +| Snap to the origin | F7 | +| Snap the angle to the zero | F8 | diff --git a/defaultcontrols.py b/defaultcontrols.py index f102aa0..72f4153 100644 --- a/defaultcontrols.py +++ b/defaultcontrols.py @@ -58,6 +58,10 @@ def defaultcontrols(): cMin = i.pointB return GyroVector(cMin,gPlayer.cRot) aoEngineEvents.append(EngineEvent('gPlayer', fX, tsArguments=('level','gPlayer'))) + if event.key == pygame.K_F7: + aoEngineEvents.append(EngineEvent('gPlayer', lambda tgPlayer: GyroVector(0, tgPlayer[0].cRot))) + if event.key == pygame.K_F8: + aoEngineEvents.append(EngineEvent('gPlayer', lambda tgPlayer: GyroVector(tgPlayer[0].cPos, 1))) keys = pygame.key.get_pressed() if keys[pygame.K_d]: