Inital commit
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<title>slither.ts</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🐍</text></svg>">
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="game"></canvas>
|
||||
|
||||
<!-- ======================= HUD ======================= -->
|
||||
<div id="hud" class="hidden">
|
||||
<div id="leaderboard" class="panel">
|
||||
<div class="lb-title">Leaderboard</div>
|
||||
<div id="lb-rows"></div>
|
||||
</div>
|
||||
<div id="scorebar">
|
||||
<span id="score">0</span>
|
||||
<span id="score-sub">rank #– · best 0 · kills 0</span>
|
||||
</div>
|
||||
<div id="hint">move: mouse · boost: <b>SPACE</b> / click</div>
|
||||
<canvas id="minimap" width="180" height="180"></canvas>
|
||||
</div>
|
||||
|
||||
<!-- ======================= MAIN MENU ======================= -->
|
||||
<div id="menu">
|
||||
<div class="menu-box">
|
||||
<h1 class="title">slither<span class="title-dot">.</span>ts</h1>
|
||||
<div class="subtitle">a typescript slither.io clone</div>
|
||||
<input id="nick" maxlength="16" placeholder="Nickname" autocomplete="off" spellcheck="false">
|
||||
<button id="play" class="btn btn-play">Play</button>
|
||||
<button id="settings-btn" class="btn btn-ghost">Settings</button>
|
||||
<div id="menu-error" class="error hidden"></div>
|
||||
</div>
|
||||
<button id="fullscreen-btn" title="Fullscreen">⛶</button>
|
||||
<div class="footer">eat pellets · grow huge · cut others off · don't touch the red border</div>
|
||||
</div>
|
||||
|
||||
<!-- ======================= SETTINGS ======================= -->
|
||||
<div id="settings" class="hidden">
|
||||
<div class="menu-box">
|
||||
<h2 class="title-small">Settings</h2>
|
||||
<label class="row">
|
||||
<span>Sound volume</span>
|
||||
<input id="opt-volume" type="range" min="0" max="100" value="60">
|
||||
</label>
|
||||
<label class="row">
|
||||
<span>Graphics quality</span>
|
||||
<select id="opt-quality">
|
||||
<option value="high">High</option>
|
||||
<option value="low">Low</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="row">
|
||||
<span>Show minimap</span>
|
||||
<input id="opt-minimap" type="checkbox" checked>
|
||||
</label>
|
||||
<label class="row">
|
||||
<span>Fullscreen</span>
|
||||
<input id="opt-fullscreen" type="checkbox">
|
||||
</label>
|
||||
<button id="settings-back" class="btn btn-play">Back</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ======================= DEATH SCREEN ======================= -->
|
||||
<div id="death" class="hidden">
|
||||
<div class="menu-box death-box">
|
||||
<h2 class="title-small">You died!</h2>
|
||||
<div class="death-stats">
|
||||
<div><span class="stat-label">Score</span><span id="d-score" class="stat-value">0</span></div>
|
||||
<div><span class="stat-label">Best</span><span id="d-best" class="stat-value">0</span></div>
|
||||
<div><span class="stat-label">Kills</span><span id="d-kills" class="stat-value">0</span></div>
|
||||
</div>
|
||||
<button id="respawn" class="btn btn-play">Respawn</button>
|
||||
<div class="hint-small">press <b>Enter</b> to respawn instantly</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="./js/client/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,155 @@
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
|
||||
html, body {
|
||||
width: 100%; height: 100%;
|
||||
overflow: hidden;
|
||||
background: #101216;
|
||||
font-family: 'Segoe UI', 'Trebuchet MS', Verdana, sans-serif;
|
||||
color: #e8ecf1;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
#game { position: fixed; inset: 0; display: block; cursor: crosshair; }
|
||||
|
||||
.hidden { display: none !important; }
|
||||
|
||||
/* ---------------- overlay screens ---------------- */
|
||||
#menu, #settings, #death {
|
||||
position: fixed; inset: 0;
|
||||
display: flex; flex-direction: column;
|
||||
align-items: center; justify-content: center;
|
||||
background: radial-gradient(ellipse at center, rgba(16,18,22,0.55) 0%, rgba(10,11,14,0.88) 100%);
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.menu-box {
|
||||
display: flex; flex-direction: column; align-items: center; gap: 14px;
|
||||
padding: 44px 56px;
|
||||
background: rgba(20, 23, 29, 0.82);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 18px;
|
||||
box-shadow: 0 24px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 64px; font-weight: 800; letter-spacing: 1px;
|
||||
background: linear-gradient(90deg, #7dff5b, #4dffd2, #4dc9ff, #c95bff);
|
||||
-webkit-background-clip: text; background-clip: text;
|
||||
-webkit-text-fill-color: transparent; color: transparent;
|
||||
filter: drop-shadow(0 0 18px rgba(77, 255, 210, 0.25));
|
||||
}
|
||||
.title-dot { -webkit-text-fill-color: #ff5b5b; color: #ff5b5b; }
|
||||
.title-small { font-size: 34px; font-weight: 700; color: #e8ecf1; }
|
||||
.subtitle { margin-top: -10px; color: #8b93a1; font-size: 14px; letter-spacing: 2px; text-transform: uppercase; }
|
||||
|
||||
#nick {
|
||||
width: 260px; padding: 12px 16px;
|
||||
font-size: 17px; text-align: center; color: #e8ecf1;
|
||||
background: rgba(255,255,255,0.06);
|
||||
border: 1px solid rgba(255,255,255,0.14);
|
||||
border-radius: 10px; outline: none;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
}
|
||||
#nick:focus { border-color: #4dffd2; box-shadow: 0 0 14px rgba(77,255,210,0.25); }
|
||||
|
||||
.btn {
|
||||
width: 260px; padding: 13px 0;
|
||||
font-size: 19px; font-weight: 700; letter-spacing: 0.5px;
|
||||
border: none; border-radius: 10px; cursor: pointer;
|
||||
transition: transform 0.08s, box-shadow 0.15s, filter 0.15s;
|
||||
}
|
||||
.btn:active { transform: scale(0.97); }
|
||||
.btn-play {
|
||||
color: #06281c;
|
||||
background: linear-gradient(180deg, #6dff9e, #2fd977);
|
||||
box-shadow: 0 4px 24px rgba(61, 230, 137, 0.35), inset 0 1px 0 rgba(255,255,255,0.5);
|
||||
}
|
||||
.btn-play:hover { filter: brightness(1.08); box-shadow: 0 4px 32px rgba(61, 230, 137, 0.55); }
|
||||
.btn-ghost {
|
||||
color: #c6cdd8;
|
||||
background: rgba(255,255,255,0.07);
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
}
|
||||
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
|
||||
|
||||
#fullscreen-btn {
|
||||
position: fixed; top: 18px; right: 18px;
|
||||
width: 46px; height: 46px; font-size: 24px; line-height: 1;
|
||||
color: #c6cdd8; background: rgba(255,255,255,0.07);
|
||||
border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
|
||||
cursor: pointer; z-index: 30;
|
||||
}
|
||||
#fullscreen-btn:hover { background: rgba(255,255,255,0.14); }
|
||||
|
||||
.footer { position: fixed; bottom: 22px; color: #6b7280; font-size: 13px; letter-spacing: 1px; }
|
||||
.error { color: #ff7070; font-size: 14px; }
|
||||
|
||||
/* settings rows */
|
||||
.row {
|
||||
width: 300px; display: flex; align-items: center; justify-content: space-between;
|
||||
font-size: 15px; color: #c6cdd8; gap: 16px;
|
||||
}
|
||||
.row input[type=range] { width: 150px; accent-color: #2fd977; }
|
||||
.row input[type=checkbox] { width: 20px; height: 20px; accent-color: #2fd977; }
|
||||
.row select {
|
||||
padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.14);
|
||||
background: #1a1e25; color: #e8ecf1; outline: none;
|
||||
}
|
||||
|
||||
/* ---------------- HUD ---------------- */
|
||||
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
|
||||
|
||||
.panel {
|
||||
background: rgba(12, 14, 18, 0.55);
|
||||
border: 1px solid rgba(255,255,255,0.07);
|
||||
border-radius: 12px;
|
||||
backdrop-filter: blur(3px);
|
||||
}
|
||||
|
||||
#leaderboard {
|
||||
position: fixed; top: 16px; right: 16px;
|
||||
width: 210px; padding: 10px 14px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.lb-title {
|
||||
font-weight: 700; font-size: 14px; letter-spacing: 1px; text-transform: uppercase;
|
||||
color: #9aa3b2; margin-bottom: 6px; text-align: center;
|
||||
}
|
||||
.lb-row { display: flex; gap: 8px; padding: 2px 4px; border-radius: 6px; color: #cfd6e0; white-space: nowrap; overflow: hidden; }
|
||||
.lb-row .lb-rank { width: 20px; color: #7c8494; text-align: right; }
|
||||
.lb-row .lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
|
||||
.lb-row .lb-score { color: #9aa3b2; }
|
||||
.lb-row.me { background: rgba(77, 255, 210, 0.14); color: #7dffd8; font-weight: 700; }
|
||||
.lb-row.me .lb-score, .lb-row.me .lb-rank { color: #7dffd8; }
|
||||
|
||||
#scorebar {
|
||||
position: fixed; left: 18px; bottom: 16px;
|
||||
display: flex; flex-direction: column;
|
||||
text-shadow: 0 2px 8px rgba(0,0,0,0.8);
|
||||
}
|
||||
#score { font-size: 34px; font-weight: 800; color: #fff; line-height: 1; }
|
||||
#score-sub { font-size: 13px; color: #9aa3b2; margin-top: 4px; }
|
||||
|
||||
#hint {
|
||||
position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
|
||||
font-size: 12px; color: #6b7280; letter-spacing: 1px;
|
||||
text-shadow: 0 2px 6px rgba(0,0,0,0.8);
|
||||
}
|
||||
|
||||
#minimap {
|
||||
position: fixed; right: 16px; bottom: 16px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid rgba(255, 60, 70, 0.5);
|
||||
box-shadow: 0 0 24px rgba(0,0,0,0.6), 0 0 12px rgba(255,60,70,0.25);
|
||||
background: rgba(10, 12, 16, 0.6);
|
||||
}
|
||||
|
||||
/* death screen */
|
||||
.death-box { min-width: 340px; }
|
||||
.death-stats { display: flex; gap: 34px; margin: 6px 0 10px; }
|
||||
.death-stats > div { display: flex; flex-direction: column; align-items: center; }
|
||||
.stat-label { font-size: 12px; color: #8b93a1; text-transform: uppercase; letter-spacing: 1px; }
|
||||
.stat-value { font-size: 30px; font-weight: 800; color: #fff; }
|
||||
.hint-small { font-size: 12px; color: #6b7280; }
|
||||
Reference in New Issue
Block a user