Skip to content

Commit ff1366d

Browse files
author
Raven
committed
add(#2): score tracking and UI.
1 parent f205ee4 commit ff1366d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

main.py

+10
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def render(self, image):
250250
previous_shot_tracer = ((index_tip[0], index_tip[1]), (end[0], end[1]))
251251
previous_shot_time = current_time
252252
for i in reversed(hit_indices):
253+
score += SCORE_PER_KILL
253254
rect_list.pop(i)
254255

255256
if previous_shot_tracer is not None:
@@ -284,6 +285,15 @@ def render(self, image):
284285
(0, 0, 255),
285286
4,
286287
)
288+
cv2.putText(
289+
image,
290+
f"Score: {score}",
291+
(75, 200),
292+
cv2.FONT_HERSHEY_SIMPLEX,
293+
2,
294+
(0, 0, 255),
295+
4,
296+
)
287297

288298
cv2.imshow("MediaPipe Hands", image)
289299
if cv2.waitKey(5) & 0xFF == 27:

0 commit comments

Comments
 (0)