js实现一个推冰块过关PINK ICE游戏代码
代码语言:html
所属分类:游戏
代码描述:js实现一个推冰块过关PINK ICE游戏代码,使用键盘方向键或点击方向来移动粉红色的冰块到右侧绿色区域即可过关。
代码标签: js 推 冰块 过关 PINK ICE 游戏 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&display=swap");
html {
font-size: 3vh;
}
@media (orientation: portrait) {
html {
font-size: 2.9vw;
}
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
color: #fff;
background-color: #000038;
overflow: hidden;
font-family: "Archivo Black", sans-serif;
font-weight: 700;
font-size: 1.5rem;
}
.level {
position: absolute;
top: 0.75rem;
left: 1rem;
}
@media (min-height: 500px), (orientation: portrait) {
.level {
top: 0.5rem;
}
}
.refresh,
.fullscreen {
position: absolute;
padding: 0.2rem 0.6rem;
border: 1px solid #fff;
font-weight: 500;
background-color: #000038;
cursor: pointer;
text-transform: uppercase;
}
.refresh:hover,
.fullscreen:hover {
color: #000038;
background-color: #fff;
}
@media (min-height: 500px), (orientation: portrait) {
.refresh,
.fullscreen {
font-size: 1rem;
}
}
.refresh {
top: 0.5rem;
right: 1rem;
}
.fullscreen {
top: 0.5rem;
left: 4rem;
}
.controls {
position: absolute;
top: 0;
left: 0;
display: flex;
flex-wrap: wrap;
width: 100%;
height: 100%;
}
.controls__arrow {
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
.controls__arrow:after {
content: "";
width: 0;
height: 0;
margin: 1rem;
opacity: 0.3;
}
.controls__arrow--top, .controls__arrow--bottom {
width: 100%;
height: 40vh;
}
.controls__arrow--left, .controls__arrow--right {
flex-direction: column;
width: 50%;
height: 20vh;
}
.controls__arrow--top, .controls__arrow--left {
align-items: flex-start;
}
.controls__arrow--bottom, .controls__arrow--right {
align-items: flex-end;
}
.controls__arrow--top:after {
border-left: 1rem solid transparent;
border-right: 1rem solid transparent;
border-bottom: 1rem solid #fff;
}
.controls__arrow--left:after {
border-top: 1rem solid transparent;
border-right: 1rem solid #fff;
border-bottom: 1rem solid transparent;
}
.controls__arrow--right:after {
border-top: 1rem solid transparent;
border-left: 1rem solid #fff;
border-bottom: 1rem solid transparent;
}
.controls__arrow--bottom:after {
border-left: 1rem solid transparent;
border-right: 1rem solid transparent;
border-top: 1rem solid #fff;
}
.timer {
position: absolute;
top: 55%;
font-size: 3rem;
}
.title-screen {
position: absolute;
top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 56, 0.8);
}
.title-screen--hidden {
display: none;
}
.title-screen__title {
position: relative;
font-size: 12vw;
color: #fff;
}
.title-screen__word {
color: #eb80b1;
}
.title-screen__button {
position: relative;
border: 1px solid #fff;
color: #fff;
padding: 0.3rem 0.6rem;
background-color: transparent;
font-size: 3vw;
font-family: "Archivo Black", sans-serif;
text-transform: uppercase;
cursor: pointer;
}
.title-screen__button:hover {
color: #000038;
background-color: #fff;
}
@media (orientation: portrait) {
.title-screen__title {
font-size: 18vw;
}
.title-screen__button {
font-size: 4.5vw;
}
}
.game {
position: relative;
display: flex;
flex-wrap: wrap;
width: 29.03rem;
}
.game--tutorial:before {
position: absolute;
bottom: -4rem;
content: "Use arrow keys (recommended) or click the arrows to play";
color: #fff.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0