READY
This commit is contained in:
parent
8b9636305c
commit
80f5f36e47
|
@ -0,0 +1,4 @@
|
|||
.score
|
||||
NUL
|
||||
env
|
||||
__pycache__
|
25
game.py
25
game.py
|
@ -174,6 +174,7 @@ def main() -> int:
|
|||
music.kill()
|
||||
lost_sfx()
|
||||
die()
|
||||
capture.release()
|
||||
return score
|
||||
|
||||
for positions in finger_positions:
|
||||
|
@ -206,5 +207,27 @@ def main() -> int:
|
|||
show_frame(frame, to_stdout=(not sys.stdout.isatty()))
|
||||
i += 1
|
||||
|
||||
def found_hands() -> bool:
|
||||
capture: cv2.VideoCapture = cv2.VideoCapture(0)
|
||||
hands = mp_hands.Hands(max_num_hands=1)
|
||||
success, frame = capture.read()
|
||||
if not success:
|
||||
return False
|
||||
|
||||
positions = list(get_finger_positions(frame, hands))
|
||||
return positions != []
|
||||
|
||||
if __name__ == '__main__':
|
||||
save_score(main())
|
||||
highscore = 0
|
||||
|
||||
while True:
|
||||
if found_hands():
|
||||
# save_score(main())
|
||||
score = main()
|
||||
highscore = max(highscore, score)
|
||||
print(f"You're score was: {score}.")
|
||||
print(f"The highscore is: {highscore}.")
|
||||
cv2.destroyAllWindows()
|
||||
print(f"\033[3{random.randint(1,8)}mShow your Hands\033[m")
|
||||
sleep(1)
|
||||
|
||||
|
|
|
@ -22,3 +22,5 @@ pyparsing==3.0.9
|
|||
python-dateutil==2.8.2
|
||||
six==1.16.0
|
||||
sounddevice==0.4.6
|
||||
requests==2.31.0
|
||||
|
||||
|
|
Loading…
Reference in New Issue