js+css实现小船河流行驶避障类游戏代码

代码语言:html

所属分类:游戏

代码描述:js+css实现小船河流行驶避障类游戏代码

代码标签: js+css实现小船河流行驶避障类游戏代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>River Rush — Dodge the Rapids</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Crimson+Pro:wght@400;600&display=swap" rel="stylesheet">
<style>
:root {
  --river-deep: #0b4f6c;
  --river-mid: #1a7a8a;
  --river-light: #2ec4b6;
  --foam: #cbf3f0;
  --accent: #ff6b35;
  --accent-glow: #ff9f1c;
  --bg-dark: #062a33;
  --text-light: #e8f7f5;
  --text-muted: #7fb5bf;
  --danger: #e63946;
  --gold: #ffd166;
}

* { margin:0; padding:0; box-sizing:border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: 'Crimson Pro', Georgia, serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ─── HUD ─── */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  z-index: 30;
  pointer-events: none;
}

.hud-block {
  background: rgba(6, 42, 51, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(46, 196, 182, 0.25);
  border-radius: 12px;
  padding: 8px 16px;
  color: var(--text-light);
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.08em;
  font-size: 1.1rem;
  min-width: 90px;
  text-align: center;
}

.hud-block .label {
  font-family: 'Crimson Pro', serif;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

.hud-block .value {
  font-size: 1.5rem;
  color: var(--gold);
}

.hud-block .value.danger {
  color: var(--danger);
}

.lives-display {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 2px;
}

.life-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 107, 53, 0.5);
  transition: all 0.3s ease;
}

.life-icon.lost {
  background: rgba(127, 181, 191, 0.25);
  box-shadow: none;
}

/* ─── OVERLAYS ─── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(6, 42, 51, 0.88);
  backdrop-filter: blur(14px);
  opacity: 1;
  transition: opacity 0.4s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--foam);
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 0.........完整代码请登录后点击上方下载按钮下载查看

网友评论0