js实现平地搭高楼游戏代码

代码语言:html

所属分类:游戏

代码描述:js实现平地搭高楼游戏代码

代码标签: js 平地 高楼 游戏 代码

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

<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
<style>
    :root {
	color-scheme: dark;
	font-family:
		Inter,
		system-ui,
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		sans-serif;
}

* {
	box-sizing: border-box;
}

html,
body {
	width: 100%;
	height: 100%;
	margin: 0;
	overflow: hidden;
	background: #6fc9ff;
}

body {
	display: grid;
	place-items: center;
}

button {
	font: inherit;
}

.game {
	position: relative;
	width: 100vw;
	height: 100dvh;
	max-height: 920px;
	overflow: hidden;
	background: #8bd6ff;
	isolation: isolate;
	touch-action: manipulation;
}

canvas {
	display: block;
	width: 100%;
	height: 100%;
}

.hud {
	position: absolute;
	inset: 0 0 auto;
	z-index: 3;
	display: flex;
	align-items: flex-start;
	justify-content: right;
	gap: 12px;
	padding: 18px;
	pointer-events: none;
}

.score-card,
.best-card {
	min-width: 100px;
	padding: 11px 14px;
	border: 3px solid rgba(37, 54, 74, 0.92);
	border-radius: 13px;
	color: #27364a;
	background: rgba(255, 245, 202, 0.94);
	box-shadow:
		0 5px 0 rgba(37, 54, 74, 0.24),
		inset 0 2px 0 rgba(255, 255, 255, 0.7);
	text-align: center;
}

.hud-label {
	display: block;
	margin-bottom: 2px;
	font-size: 0.65rem;
	font-weight: 900;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	opacity: 0.7;
}

.hud-value {
	display: block;
	font-size: 1.55rem;
	font-weight: 950;
	line-height: 1;
}

.instructions {
	position: absolute;
	left: 50%;
	bottom: 30px;
	z-index: 4;
	width: max-content;
	max-width: calc(100% - 40px);
	transform: translateX(-50%);
	padding: 11px 18px;
	border: 3px solid rgba(37, 54, 74, 0.9);
	border-radius: 999px;
	color: #27364a;
	background: rgba(255, 255, 255, 0.9);
	box-shadow: 0 5px 0 rgba(37, 54, 74, 0.2);
	font-size: 0.84rem;
	font-weight: 900;
	text-align: center;
	pointer-events: none;
	transition:
		opacity 200ms ease,
		transform 200ms ease;
}

.instructions.hidden {
	opacity: 0;
	transform: translate(-50%, 12px);
}

.overlay {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: grid;
	place-items: center;
	padding: 24px;
	background: rgba(34, 60, 94, 0.28);
	backdrop-filter: blur(5px);
}

.overlay[hidden] {
	display: none;
}

.panel {
	width: min(100%, 360px);
	padding: 28px 24px 24px;
	border: 4px solid #26364b;
	border-radius: 24px;
	color: #26364b;
	background: #fff3bd;
	box-shadow:
		0 12px 0 rgba(38, 54, 75, 0.25),
		inset 0 3px 0 rgba(255, 255, 255, 0.8);
	text-align: center;
}

.panel h1 {
	margin: 0;
	font-size: clamp(2.2rem, 12vw, 4rem);
	font-weight: 1000;
	line-height: 0.9;
	letter-spacing: -0.07em;
	text-transform: uppercase;
	text-shadow: 0 4px 0 r.........完整代码请登录后点击上方下载按钮下载查看

网友评论0