jquery实现一个指挥火车运输到指定仓库游戏代码
代码语言:html
所属分类:游戏
代码描述:jquery实现一个指挥火车运输到指定仓库游戏代码,通过点击路口指示牌来指挥火车运行方向到达目的地。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<link href='https://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Chewy' rel='stylesheet' type='text/css'>
<style>
html, body {
height: 100%;
}
body {
position: relative;
margin: 0;
}
select {
border: none;
outline: none;
}
button {
outline: none;
border: none;
cursor: pointer;
}
body, button {
font-family: "Oswald", sans-serif;
font-weight: 300;
}
/* LANDSCAPE */
.sky, .land {
position: relative;
}
.sky {
background-color: #D9F1FB;
height: 14em;
}
.land {
background-color: #EAE2D7;
min-height: 30em;
}
.sun {
position: relative;
left: 24em;
background: gold;
height: 0;
width: 0;
padding: 2em;
border-radius: 50%;
border: 0.8em solid goldenrod;
}
/* CLOUDS */
.clouds .cloud {
position: absolute;
}
.clouds .cloud .base {
position: absolute;
top: 2em;
left: -1.5em;
height: 1.6em;
width: 8em;
background-color: ghostwhite;
border-radius: 1em;
box-shadow: inset -2.2em 0 0 beige;
}
.clouds .cloud .big_bubble {
border: 2.5em solid beige;
}
.clouds .cloud .small_bubble {
position: absolute;
top: 1em;
left: -0.1em;
border: 1.5em solid ghostwhite;
}
.clouds .cloud .small_bubble, .clouds .cloud .big_bubble {
height: 0;
width: 0;
border-radius: 50%;
transform: rotate(45deg);
border-bottom-color: transparent;
border-right-color: transparent;
}
.clouds .cloud:nth-child(1) {
top: 1.5em;
left: 13em;
transform: scale(1.2);
}
.clouds .cloud:nth-child(2) {
top: 1em;
left: 33em;
transform: scale(1.1, 0.9);
}
.clouds .cloud:nth-child(3) {
top: 0.6em;
left: 48em;
}
.clouds .cloud:nth-child(4) {
top: 1em;
left: 62em;
transform: scale(1.1);
}
.clouds .cloud:nth-child(5) {
top: 2em;
left: 78em;
transform: scale(1.1, 0.9);
}
.clouds .cloud:nth-child(6) {
top: 1em;
left: 88em;
transform: scale(0.8);
}
.clouds .cloud:nth-child(7) {
top: 1em;
left: 1em;
transform: scale(0.8);
}
.clouds .cloud:nth-child(9) {
top: 1em;
left: 1em;
transform: scale(0.7);
}
/* MOUNTAINS */
.mountains {
overflow: hidden;
position: relative;
height: 10em;
}
.mountains .mountain {
position: absolute;
bottom: -4em;
height: 10em;
width: 10em;
transform: rotate(45deg);
border-top-left-radius: 14%;
border-top-right-radius: 80% 20%;
border-bottom-left-radius: 20% 80%;
background: linear-gradient(45deg, #737373 50%, transparent 50%) no-repeat, linear-gradient(-45deg, transparent 50%, #737373 50%) 0 90px no-repeat, linear-gradient(135deg, grey 57.5%, transparent 57.5%) no-repeat;
}
.mountains .mountain:nth-child(1), .mountains .mountain:nth-child(5), .mountains .mountain:nth-child(7), .mountains .mountain:nth-child(10), .mountains .mountain:nth-child(11) {
transform: rotate(45deg) scale(1.2);
}
.mountains .mountain:nth-child(3), .mountains .mountain:nth-child(7), .mountains .mountain:nth-child(9) {
background: linear-gradient(45deg, #8a8b18 50%, transparent 50%) no-repeat, linear-gradient(-45deg, transparent 50%, #8a8b18 50%) 0 90px no-repeat, linear-gradient(135deg, #a0a11c 57.5%, transparent 57.5%) no-repeat;
}
.mountains .mountain:nth-child(2) {
left: 16em;
}
.mountains .mountain:nth-child(3) {
left: 8em;
}
.mountains .mountain:nth-child(4) {
left: 45em;
}
.mountains .mountain:nth-child(5) {
left: 35em;
}
.mountains .mountain:nth-child(6) {
left: 60em;
}
.mountains .mountain:nth-child(7) {
left: 55em;
}
.mountains .mountain:nth-child(8) {
left: 73em;
}
.mountains .mountain:nth-child(9) {
left: 77em;
}
.mountains .mountain:nth-child(10) {
left: 87em;
}
.mountains .mountain:nth-child(11) {
left: 93em;
}
/* TREES */
.tree {
background: #35740a;
box-shadow: inset 1em 0 0 #408B0C;
border-radius: 1em;
height: 5em;
width: 2em;
transition: transform 1s;
}
.tree:nth-child(4n) {
background: #da7b33;
box-shadow: inset 1em 0 0 #de8949;
}
.tree .branch {
border: 0.2em solid #563D3D;
width: 0.8em;
height: 0.8em;
transform: rotate(45deg);
border-top: 0;
border-left: 0;
position: relative;
}
.tree .branch:before, .tree .branch:after {
content: "";
height: 0.175em;
width: 0.175em;
background-color: #563D3D;
border-radius: 50%;
position: absolute;
}
.tree .branch:after {
right: -0.178125em;
top: -0.11875em;
}
.tree .branch:before {
left: -0.11875em;
bottom: -0.178125em;
}
.tree .branch:nth-child(1) {
position: absolute;
top: 35%;
left: 25%;
}
.tree .branch:nth-child(2) {
position: absolute;
top: 60%;
left: 25%;
}
.tree .shadow {
height: 0.5em;
width: 1.5em;
background: rgba(198, 198, 198, 0.5);
border-radius: 50%;
position: absolute;
bottom: -2.2em;
left: 10%;
z-index: -1;
transition: width 1s;
}
.tree .shadow.blown {
width: 2.5em;
}
.tree .trunk {
background-color: #563D3D;
height: 5.5em;
width: 0.25em;
border-radius: 0.5em;
position: absolute;
bottom: -2em;
left: 42%;
}
.tree.blown {
transition: transform 1s;
transform: scale(0.7) skewX(-5deg) !important;
}
.tree.blown .shadow {
width: 2.5em;
}
.trees {
position: relative;
z-index: 0;
}
.trees .tree {
position: absolute;
top: -3em;
transform: scale(0.7);
}
.trees .tree:nth-child(1) {
left: 18em;
top: -3.2em;
}
.trees .tree:nth-child(2) {
left: 33em;
top: -3.5em;
}
.trees .tree:nth-child(3) {
left: 24em;
}
.trees .tree:nth-child(4) {
left: 45em;
}
.trees .tree:nth-child(5) {
left: 35em;
}
.trees .tree:nth-child(6) {
left: 66em;
}
.trees .tree:nth-child(7) {
left: 55em;
top: -3.6em;
}
.trees .tree:nth-child(8) {
left: 73em;
}
.trees .tree:nth-child(9) {
left: 75em;
top: -3.1em;
}
.trees .tree:nth-child(10) {
left: 83em;
top: -2.8em;
}
.trees .tree:nth-child(11) {
left: 89em;
}
/* INTERFACE */
button {
background: yellow;
font-size: 14px;
border-radius: 1px;
padding: 2px 8px 3px 8px;
}
button:active {
background-color: yellowgreen;
}
.board .tree {
position: absolute;
transform: scale(0.7);
}
.blink {
animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
to {
background-color: yellowgreen;
}
}
.inkdot {
animation-name: inkdot;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
@keyframes inkdot {
0% {
transform: scale(0);
}
100% {
transform: scale(1);
}
}
.info {
position: absolute;
bottom: 0;
}
.start, .change_map, .difficulty {
position: absolute;
left: -4em;
z-index: 10;
}
.start {
top: 0;
}
.change_map {
top: 2.2em;
}
.difficulty {
top: 4.4em;
font-size: 14px;
background-color: silver;
}
.level {
display: inline-block;
padding: 0.125em;
}
.score {
margin-right: 0.5em;
}
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: black;
opacity: 0.6;
filter: alpha(opacity=60);
z-index: 100;
}
.overlay-box {
position: fixed;
top: 10%;
left: 50%;
margin-left: -13em;
z-index: 101;
}
.instructions-box {
background: #c7baa8;
border: 9px solid;
width: 25em;
height: 20em;
border-radius: 1px;
border-color: #f1c40f;
border-bottom-color: #c29d0b;
border-right-color: #dab10d;
color: #66595c;
}
.js-close-overlay {
cursor: pointer;
position: absolute;
left: 92%;
top: 0%;
color: #66595c;
}
.instructions {
border: 1px solid #EAE2D7;
padding: 1.8em 1em 1em 1em;
height: 100%;
box-sizing: border-box;
font-family: sans-serif;
line-height: 22px;
}
.instructions h2 {
font-family: Oswald, sans-serif;
}
/* BOARD */
.board {
display: inline-block;
/* instead of overflow */
padding: 3em 3em 1em 5em;
}
.board .cell {
position: relative;
float: left;
/* for testing */
}
/* TREE / NODE */
.board .cell .node, .board .cell .non {
position: absolute;
top: 0;
left: 0;
border-radius: 50%;
z-index: 1;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
cursor: pointer;
font-size: 12px;
height: 2.2em;
width: 2.2em;
line-height: 2.2em;
text-align: center;
background-color: skyblue;
}
.board .cell .node.extension, .board .cell .non.extension {
background-color: palevioletred;
}
.board .cell .node.dead_end, .board .cell .non.dead_end {
background-color: #424c56;
display: none;
}
.board .cell .node.leaf, .board .cell .non.leaf {
background-color: forestgreen;
display: none;
}
.board .cell .node.root, .board .cell .non.root {
background-color: yellowgreen;
}
.board .cell .node.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0