js实现奔跑回家小游戏代码
代码语言:html
所属分类:游戏
代码描述:js实现奔跑回家小游戏代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
:root {
--map: 0%;
--map-goals: 0%;
}
html {
min-height: 100vh;
display: grid;
place-items: center;
background:
linear-gradient(to bottom right, #111 33%, #300);
color: gray;
font-family: system-ui;
font-size: 12px;
}
* {
user-select: none;
}
body {
width: 100%;
max-width: 1000px;
}
img {
margin: 0 auto;
display: grid;
}
#console {
width: 100%;
height: 400px;
position: relative;
background: #325139;
border-radius: 4px;
box-shadow: 0 10px 20px rgba(0,0,0,.5);
perspective: 1000px;
overflow: hidden;
border-radius: 5px;
}
#console:before {
content: '';
position: absolute;
inset: 0;
background:
radial-gradient(circle at 50% 75%, transparent, rgba(0,0,0,1));
z-index: 300;
pointer-events: none;
}
#console:after {
content: '';
position: absolute;
inset: 0;
background:
linear-gradient(to bottom, #325139, transparent 50%);
z-index: 200;
pointer-events: none;
}
#console * {
user-select: none;
}
.stop_animation .tree,
.stop_animation .pit {
animation-play-state: paused !important;
}
#road_map {
width: 250px;
height: 5px;
border-radius: 10px;
background:
linear-gradient(to right, rgba(255,255,255,.25) calc(100% - 3px), transparent calc(100% - 3px));
background-size: var(--map-goals) 100%;
position: absolute;
left: calc(50% - 125px);
top: 15px;
z-index: 500;
}
#road_map:before {
content:'';
width: 20px;
height: 20px;
background:
url('//repo.bfw.wiki/bfwrepo/images/game/penbao/avaster.png');
background-size: 100% 100%;
position: absolute;
left: var(--map);
top: -7.5px;
transform: translateX(-50%);
filter: drop-shadow(0 0 1px white);
transition: .25s;
z-index: 10;
}
#road_map:after {
content:'';
width: 20px;
height: 20px;
background: white;
position: absolute;
left: 100%;
top: -7.5px;
transform: translateX(-50%);
clip-path: polygon(50% 0%, 100% 50%, 80% 50%, 80% 100%, 60% 100%, 60% 60%, 40% 60%, 40% 100%, 20% 100%, 20% 50%, 0% 50%);
}
#map_color {
width: var(--map);
height: 5px;
border-radius: 10px;
background: #cc0000;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0