This commit is contained in:
Jonas Zeunert
2022-08-31 17:28:24 +02:00
parent 52bfa8c6fe
commit 5fb8bb54f0
2 changed files with 18 additions and 8 deletions

View File

@@ -11,7 +11,7 @@ class GameState:
credits = config.BALLS_PER_GAME
isPlaying = False
isStarted = False
isIdle = True
isIdle = asyncio.Event()
def __init__(self, playerStateFactory, highscore, specialDisplay, currentPlayerID = 0):
CREDIT.activate()
@@ -48,7 +48,7 @@ class GameState:
pass
def stopIdleLoop(self):
self.isIdle = False
self.isIdle.set()
pass
async def idleLoop(self):
@@ -56,12 +56,16 @@ class GameState:
UPPER_PLAYFIELD_TIME_LAMPS, TUNNEL_NUMBER_LAMPS,
TUNNEL_LAMPS, TUNNEL_SCORE_LAMPS]
while True:
for lamps in all_cabinet_lamps:
for _ in lamps.lamps:
lamps.cycle()
if not self.isIdle:
return
time.sleep(0.1)
#for lamps in all_cabinet_lamps:
#for _ in lamps.lamps:
#lamps.cycle()
#if not self.isIdle:
# return
#time.sleep(0.1)
random_group = random.choice(all_cabinet_lamps)
random_group.toggleRandom(0.2)
if self.isIdle.is_set():
return
def createPlayers(self, playerCount):
players = []