|
|
|
@ -177,6 +177,7 @@ InputEvent = enum.Enum('InputEvent', ['UP', 'DOWN', 'LEFT',
@@ -177,6 +177,7 @@ InputEvent = enum.Enum('InputEvent', ['UP', 'DOWN', 'LEFT',
|
|
|
|
|
|
|
|
|
|
class AbstractInput(): |
|
|
|
|
def __init__(self): |
|
|
|
|
self.player_present = False |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
def get_event(self): |
|
|
|
@ -203,6 +204,8 @@ class TestInput(AbstractInput):
@@ -203,6 +204,8 @@ class TestInput(AbstractInput):
|
|
|
|
|
pygame = self.__pygame |
|
|
|
|
for event in pygame.event.get(): |
|
|
|
|
if event.type == pygame.KEYDOWN: |
|
|
|
|
if self.control.get(event.key, None) == InputEvent.STEP_ON: |
|
|
|
|
self.player_present = True |
|
|
|
|
return self.controls.get(event.key, None) |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
@ -370,7 +373,7 @@ if __name__ == '__main__':
@@ -370,7 +373,7 @@ if __name__ == '__main__':
|
|
|
|
|
while time.time() < start+wait_time: |
|
|
|
|
while True: |
|
|
|
|
evt = inp2.get_event() |
|
|
|
|
if evt == InputEvent.STEP_ON: |
|
|
|
|
if inp2.player_present: |
|
|
|
|
inp1.running = False |
|
|
|
|
inp2.running = False |
|
|
|
|
start_game(game, 2) |
|
|
|
|