Nachricht nach richtiger Aktion eingefügt
This commit is contained in:
parent
04c89df25b
commit
50633ed4f7
@ -11,9 +11,9 @@ tilt = Button(23)
|
|||||||
def command_tilt():
|
def command_tilt():
|
||||||
print("Tilt me!")
|
print("Tilt me!")
|
||||||
result = tilt.wait_for_press(timeout=10)
|
result = tilt.wait_for_press(timeout=10)
|
||||||
print(f"Result: {result}")
|
|
||||||
if result:
|
if result:
|
||||||
time.sleep(0.3) # soll verhindern, dass die vorherige Runde die jetzige beeinflusst
|
time.sleep(0.3) # soll verhindern, dass die vorherige Runde die jetzige beeinflusst
|
||||||
|
print(success_message())
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1
|
||||||
@ -23,8 +23,8 @@ def command_tilt():
|
|||||||
def command_blind():
|
def command_blind():
|
||||||
print('Blind me!')
|
print('Blind me!')
|
||||||
result = laser.wait_for_press(timeout=10)
|
result = laser.wait_for_press(timeout=10)
|
||||||
print(f"Result: {result}")
|
|
||||||
if result:
|
if result:
|
||||||
|
print(success_message())
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1
|
||||||
@ -32,9 +32,9 @@ def command_blind():
|
|||||||
def command_scream():
|
def command_scream():
|
||||||
print('Make noise at me!')
|
print('Make noise at me!')
|
||||||
result = sound.wait_for_press(timeout=10)
|
result = sound.wait_for_press(timeout=10)
|
||||||
print(f"Result: {result}")
|
|
||||||
if result:
|
if result:
|
||||||
time.sleep(0.3) #soll verhindern, dass dasGeräuschsignal aus der vorherigen Runde gezählt wird
|
time.sleep(0.3) #soll verhindern, dass dasGeräuschsignal aus der vorherigen Runde gezählt wird
|
||||||
|
print(success_message())
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1
|
||||||
@ -43,6 +43,7 @@ def command_spin_clockwise():
|
|||||||
print("Spin me... clockwise!")
|
print("Spin me... clockwise!")
|
||||||
result = rotate.wait_for_rotate_clockwise(timeout=10)
|
result = rotate.wait_for_rotate_clockwise(timeout=10)
|
||||||
if result:
|
if result:
|
||||||
|
print(success_message())
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1
|
||||||
@ -51,10 +52,16 @@ def command_spin_counter_clockwise():
|
|||||||
print("Spin me... counter clockwise!")
|
print("Spin me... counter clockwise!")
|
||||||
result = rotate.wait_for_rotate_counter_clockwise(timeout=10)
|
result = rotate.wait_for_rotate_counter_clockwise(timeout=10)
|
||||||
if result:
|
if result:
|
||||||
|
print(success_message())
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
def success_message():
|
||||||
|
list_of_messages = ["Great job!", "Correct!", "Nice!", "You know it!", "That's what I'm talking about", "Perfect!"]
|
||||||
|
message = random.choice(list_of_messages)
|
||||||
|
return message
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
score = 0
|
score = 0
|
||||||
result = 0
|
result = 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user