js实现一个简单类似超级玛丽闯关小游戏代码

代码语言:html

所属分类:游戏

代码描述:js实现一个简单类似超级玛丽闯关小游戏代码

代码标签: js 简单 类似 超级 玛丽 闯关 小游戏 代码

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

<!doctype html>
<html>
<head>
<meta charset="utf-8">


<style>
body {
  background: #222;
}

h2 {
  color: #666;
  font-family: monospace;
  text-align: center;
}

.background {
  table-layout: fixed;
  border-spacing: 0;
}

.background td {
  padding: 0;
}

.lava, .actor {
  background: #e55;
}

.wall {
  background: #444;
  border: solid 3px #333;
  box-sizing: content-box;
}

.actor {
  position: absolute;
}

.coin {
  background: #e2e838;
  border-radius: 50%;
}

.player {
  background: #335699;
  box-shadow: none;
}

.lost .player {
  background: #a04040;
}

.won .player {
  background: green;
}

.game {
  position: relative;
  overflow: hidden;
}
</style>
</head>
<body>

<h2>简单JavaScript闯关小游戏</h2>

<script>
var LEVELS = [
	["                                                                                ",
		"                                                                                ",
		"                                                                                ",
		"                                                                                ",
		"                                                                                ",
		"                                                                                ",
		"                                                                  xxx           ",
		"                                                   xx      xx    xx!xx          ",
		"                                    o o      xx                  x!!!x          ",
		"                                                                 xx!xx          ",
		"                                   xxxxx                          xvx           ",
		"                                                                            xx  ",
		"  xx                                      o o                                x  ",
		"  x                     o                                                    x  ",
		"  x                                      xxxxx                             o x  ",
		"  x          xxxx       o                                                    x  ",
		"  x  @       x  x                                                xxxxx       x  ",
		"  xxxxxxxxxxxx  xxxxxxxxxxxxxxx   xxxxxxxxxxxxxxxxxxxx     xxxxxxx   xxxxxxxxx  ",
		"                              x   x                  x     x                    ",
		"               .........完整代码请登录后点击上方下载按钮下载查看

网友评论0