body {
overflow:hidden;
height:500px;
}
#player {
position:absolute;
background:black;
width:100px;
height:100px;
z-index:900;
}
#gift {
position:absolute;
background:green;
width:20px;
height:20px;
}
.enemy {
position:absolute;
background:red;
width:30px;
height:30px;
}
#container {
position:absolute;
width:95%;
height:95%;
}
#score {
position:absolute;
z-index:-1;
width:100%;
height:600px;
line-height:600px;
text-align:center;
font-size:200px;
color:lightgray;
-webkit-user-select:none;
-moz-user-select:none;
-khtml-user-select:none;
-ms-user-select:none;
}
#time {
position:absolute;
z-index:-1;
width:100%;
height:600px;
top:60%;
left:50px;
z-index:9999;
font-size:30px;
}
#btn {
position:absolute;
top:50%;
left:50%;
margin-left:-150px;
margin-top:-100px;
border:hidden;
color:white;
background:gray;
width:300px;
height:200px;
font-size:40px;
}
p {
font-size:40px;
}
记得吃绿色的豆豆,尽量不要碰到红色的。
吃到绿色的加一分,碰到红色的扣三分,并且还会随机生成两个红色的豆豆。
代码可能不够完善,希望大家能够多多指教啦~