TomatitoToho commited on
Commit
751d759
·
verified ·
1 Parent(s): 850cc29

Upload src/components/ui/HUD.tsx with huggingface_hub

Browse files
Files changed (1) hide show
  1. src/components/ui/HUD.tsx +44 -0
src/components/ui/HUD.tsx ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use client'
2
+
3
+ import { usePlayerStore } from '@/stores/playerStore'
4
+ import { useGameStore } from '@/stores/gameStore'
5
+
6
+ export function HUD() {
7
+ const { player } = usePlayerStore()
8
+ const { fps, tps } = useGameStore()
9
+
10
+ if (!player) return null
11
+
12
+ const healthHearts = Math.ceil(player.health / 2)
13
+ const foodDrumsticks = Math.ceil(player.foodLevel / 2)
14
+
15
+ return (
16
+ <div className="absolute bottom-16 left-1/2 -translate-x-1/2 flex items-end gap-4 pointer-events-none z-10">
17
+ {/* Health */}
18
+ <div className="flex gap-0.5">
19
+ {Array.from({ length: 10 }, (_, i) => (
20
+ <div
21
+ key={`hp-${i}`}
22
+ className={`w-4 h-4 text-xs flex items-center justify-center
23
+ ${i < healthHearts ? 'text-red-500' : 'text-gray-700'}`}
24
+ >
25
+ ♥
26
+ </div>
27
+ ))}
28
+ </div>
29
+
30
+ {/* Food */}
31
+ <div className="flex gap-0.5">
32
+ {Array.from({ length: 10 }, (_, i) => (
33
+ <div
34
+ key={`food-${i}`}
35
+ className={`w-4 h-4 text-xs flex items-center justify-center
36
+ ${i < foodDrumsticks ? 'text-amber-600' : 'text-gray-700'}`}
37
+ >
38
+ 🍖
39
+ </div>
40
+ ))}
41
+ </div>
42
+ </div>
43
+ )
44
+ }