mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-20 13:50:46 +00:00
- Added hand frames PNG for interaction modes. - Updated HUD CSS to support new player HUD buttons and styles. - Enhanced combat configuration to define interaction modes: interact, jab, and cross. - Integrated player HUD creation and management in the game core. - Improved player combat system to handle interaction modes and associated animations. - Modified interaction handling to auto-switch modes for chairs and hostile NPCs. - Updated health UI to always display health status. - Created a new HUD JavaScript module to manage avatar and interaction mode toggle. - Added a test HTML file for the three-mode toggle functionality.
320 lines
6.7 KiB
CSS
320 lines
6.7 KiB
CSS
/* HUD (Heads-Up Display) System Styles */
|
|
/* Combines Inventory, Health UI, Avatar, and Mode Toggle */
|
|
|
|
/* ===== PLAYER HUD BUTTONS (inside inventory) ===== */
|
|
|
|
#player-hud-buttons {
|
|
display: flex;
|
|
flex-direction: row;
|
|
gap: 8px;
|
|
margin-right: 16px;
|
|
align-items: center;
|
|
}
|
|
|
|
/* Remove old standalone container styles */
|
|
#player-hud-container {
|
|
display: none; /* Hide if exists in HTML */
|
|
}
|
|
|
|
/* HUD Button Base Styling */
|
|
.hud-button {
|
|
width: 64px;
|
|
height: 64px;
|
|
/* semi-transparent background to show avatar or hand canvas, but with a solid border for visibility */
|
|
background: rgba(34, 34, 34, 0.6);
|
|
border: 2px solid #666666;
|
|
cursor: pointer;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: relative;
|
|
transition: border-color 0.2s ease, transform 0.1s ease;
|
|
image-rendering: pixelated;
|
|
image-rendering: -moz-crisp-edges;
|
|
image-rendering: crisp-edges;
|
|
}
|
|
|
|
.hud-button:hover {
|
|
border-color: #888888;
|
|
}
|
|
|
|
.hud-button:active {
|
|
transform: translateY(1px);
|
|
}
|
|
|
|
/* Avatar Button */
|
|
#hud-avatar-button {
|
|
border-color: #000000; /* Green to indicate player settings */
|
|
}
|
|
|
|
#hud-avatar-button:hover {
|
|
border-color: #008800; /* Brighter green */
|
|
box-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
|
|
}
|
|
|
|
#hud-avatar-img {
|
|
width: 64px;
|
|
height: 64px;
|
|
object-fit: cover;
|
|
image-rendering: pixelated;
|
|
image-rendering: -moz-crisp-edges;
|
|
image-rendering: crisp-edges;
|
|
}
|
|
|
|
/* Mode Toggle Button */
|
|
#hud-mode-toggle-button {
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 0;
|
|
}
|
|
|
|
#hud-hand-canvas {
|
|
width: 64px;
|
|
height: 64px;
|
|
image-rendering: pixelated;
|
|
image-rendering: -moz-crisp-edges;
|
|
image-rendering: crisp-edges;
|
|
}
|
|
|
|
#hud-mode-label {
|
|
font-family: 'VT323', 'Courier New', monospace;
|
|
font-size: 10px;
|
|
color: #ffffff;
|
|
text-align: center;
|
|
margin-top: 2px;
|
|
line-height: 1;
|
|
display: none; /* Hide label to make room for 64px hand icon */
|
|
}
|
|
|
|
/* Mode-specific border colors */
|
|
#hud-mode-toggle-button.mode-interact {
|
|
border-color: rgba(0, 255, 0, 0.4); /* Green */
|
|
}
|
|
|
|
#hud-mode-toggle-button.mode-jab {
|
|
border-color: rgba(0, 204, 255, 0.4); /* Cyan */
|
|
}
|
|
|
|
#hud-mode-toggle-button.mode-cross {
|
|
border-color: rgba(255, 0, 0, 0.4); /* Red */
|
|
}
|
|
|
|
/* Hover colors */
|
|
#hud-mode-toggle-button.mode-interact:hover {
|
|
border-color: rgba(0, 255, 136, 0.4); /* Brighter green */
|
|
}
|
|
|
|
#hud-mode-toggle-button.mode-jab:hover {
|
|
border-color: rgba(136, 238, 255, 0.4); /* Brighter cyan */
|
|
}
|
|
|
|
#hud-mode-toggle-button.mode-cross:hover {
|
|
border-color: rgba(255, 136, 0, 0.4); /* Orange */
|
|
}
|
|
|
|
/* Animation for mode transitions */
|
|
@keyframes mode-change {
|
|
0% {
|
|
transform: scale(1);
|
|
}
|
|
50% {
|
|
transform: scale(0.9);
|
|
opacity: 0.7;
|
|
}
|
|
100% {
|
|
transform: scale(1);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
.hud-button.animating {
|
|
animation: mode-change 0.2s ease;
|
|
}
|
|
|
|
/* ===== HEALTH UI ===== */
|
|
|
|
#health-ui-container {
|
|
position: fixed;
|
|
bottom: 80px; /* Directly above inventory (which is 80px tall) */
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
z-index: 1100;
|
|
pointer-events: none;
|
|
display: flex; /* Always show (changed from MVP requirement) */
|
|
}
|
|
|
|
.health-ui-display {
|
|
display: flex;
|
|
gap: 8px;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 12px 16px;
|
|
/* background: rgba(0, 0, 0, 0.5); */
|
|
/* border: 2px solid #333; */
|
|
/* box-shadow: 0 0 10px rgba(0, 0, 0, 0.9), inset 0 0 5px rgba(0, 0, 0, 0.5); */
|
|
}
|
|
|
|
.health-heart {
|
|
width: 32px;
|
|
height: 32px;
|
|
image-rendering: pixelated;
|
|
image-rendering: -moz-crisp-edges;
|
|
image-rendering: crisp-edges;
|
|
transition: opacity 0.2s ease-in-out;
|
|
display: block;
|
|
}
|
|
|
|
.health-heart:hover {
|
|
filter: drop-shadow(0 0 4px rgba(255, 0, 0, 0.6));
|
|
}
|
|
|
|
/* ===== INVENTORY UI ===== */
|
|
|
|
#inventory-container {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 80px;
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 20px;
|
|
z-index: 1000;
|
|
font-family: 'VT323';
|
|
overflow-x: auto;
|
|
overflow-y: hidden;
|
|
}
|
|
|
|
#inventory-container::-webkit-scrollbar {
|
|
height: 8px;
|
|
}
|
|
|
|
#inventory-container::-webkit-scrollbar-track {
|
|
background: rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
#inventory-container::-webkit-scrollbar-thumb {
|
|
background: rgba(255, 255, 255, 0.3);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.inventory-slot {
|
|
min-width: 64px;
|
|
height: 64px;
|
|
margin: 0 5px;
|
|
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
position: relative;
|
|
background: rgb(149 157 216 / 80%);
|
|
}
|
|
|
|
/* Pulse animation for newly added items */
|
|
@keyframes pulse-slot {
|
|
0% {
|
|
transform: scale(1);
|
|
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
|
|
}
|
|
50% {
|
|
transform: scale(1.5);
|
|
box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
|
|
}
|
|
100% {
|
|
transform: scale(1);
|
|
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
|
|
}
|
|
}
|
|
|
|
.inventory-slot.pulse {
|
|
animation: pulse-slot 0.6s ease-out;
|
|
}
|
|
|
|
.inventory-item {
|
|
max-width: 48px;
|
|
max-height: 48px;
|
|
cursor: pointer;
|
|
transition: transform 0.2s;
|
|
transform: scale(2);
|
|
image-rendering: pixelated;
|
|
image-rendering: -moz-crisp-edges;
|
|
image-rendering: crisp-edges;
|
|
}
|
|
|
|
.inventory-item:hover {
|
|
transform: scale(2.2);
|
|
}
|
|
|
|
.inventory-tooltip {
|
|
position: absolute;
|
|
bottom: 100%;
|
|
left: -10px;
|
|
color: white;
|
|
padding: 4px 8px;
|
|
border-radius: 4px;
|
|
font-size: 18px;
|
|
white-space: nowrap;
|
|
pointer-events: none;
|
|
opacity: 0;
|
|
transition: opacity 0.2s;
|
|
}
|
|
|
|
.inventory-item:hover + .inventory-tooltip {
|
|
opacity: 1;
|
|
}
|
|
|
|
/* Key ring specific styling */
|
|
.inventory-item[data-type="key_ring"] {
|
|
position: relative;
|
|
}
|
|
|
|
.inventory-item[data-type="key_ring"]::after {
|
|
content: attr(data-key-count);
|
|
position: absolute;
|
|
top: -5px;
|
|
right: -5px;
|
|
background: #ff6b6b;
|
|
color: white;
|
|
border-radius: 50%;
|
|
width: 18px;
|
|
height: 18px;
|
|
font-size: 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-weight: bold;
|
|
border: 2px solid #fff;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
|
|
}
|
|
|
|
/* Hide count badge for single keys */
|
|
.inventory-item[data-type="key_ring"][data-key-count="1"]::after {
|
|
display: none;
|
|
}
|
|
|
|
/* Phone unread message badge */
|
|
.inventory-slot {
|
|
position: relative;
|
|
}
|
|
|
|
.inventory-slot .phone-badge {
|
|
display: block;
|
|
position: absolute;
|
|
top: -5px;
|
|
right: -5px;
|
|
background: #5fcf69; /* Green to match phone LCD screen */
|
|
color: #000;
|
|
border: 2px solid #000;
|
|
min-width: 20px;
|
|
height: 20px;
|
|
padding: 0 4px;
|
|
line-height: 16px; /* Center text vertically (20px - 2px border * 2 = 16px) */
|
|
text-align: center;
|
|
font-size: 12px;
|
|
font-weight: bold;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.8);
|
|
z-index: 10;
|
|
border-radius: 0; /* Maintain pixel-art aesthetic */
|
|
}
|