js+css实现俄罗斯方块拼图游戏代码

代码语言:html

所属分类:游戏

代码描述:js+css实现俄罗斯方块拼图游戏代码,玩法:点击一个形状 > 点击一个网格块。填满盒子就赢了并重置游戏。

代码标签: js css 俄罗斯 方块 拼图 游戏 代码

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<style>
    body {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	height: 100vh;
	background-color: #232b2b;
	margin: 0;
	--block-width: 25px;
	font-family: system-ui;
	color: gray;
	font-size: 12px;
}

* {
	box-sizing: border-box;
}

p {
	max-width: calc(var(--block-width) * 7.5);
	user-select: none;
}

#game_box {
	position: relative;
	width: calc(var(--block-width) * 4);
	aspect-ratio: 1/1;
	outline: 2px solid black;
}

.winner {
	animation: winner 1s linear forwards;
}
@keyframes winner {
	100% {
		transform: rotate(1080deg);
	}
}

.generic_block {
	/* 	background-color: red; */
	width: var(--block-width);
	height: var(--block-width);
	float: left;
	border-right: 1px solid black;
	border-bottom: 1px solid black;
}
.generic_block:hover {
	background: gray;
}

span {
	width: var(--blo.........完整代码请登录后点击上方下载按钮下载查看

网友评论0