canvas实现大猩猩城市对决互相扔石头攻击对方游戏代码
代码语言:html
所属分类:游戏
代码描述:canvas实现大猩猩城市对决互相扔石头攻击对方游戏代码,支持与电脑对战,双人单人模式、自动模式、暗黑模式。
代码标签: canvas 大猩猩 城市 对决 互相 扔 石头 攻击 对方 游戏 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url("https://fonts.googleapis.com/css2?family=Inconsolata:wght@400;700&display=swap");
body {
margin: 0;
padding: 0;
font-family: "Inconsolata", monospace;
font-size: 14px;
color: white;
user-select: none;
-webkit-user-select: none;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
overflow: hidden;
}
button {
cursor: pointer;
border: none;
color: white;
background: transparent;
font-family: "Inconsolata", monospace;
padding: 10px;
font-size: 1em;
}
button:hover {
background-color: rgba(255, 255, 255, 0.1);
}
#info-left,
#info-right {
position: absolute;
top: 20px;
}
#info-left {
left: 25px;
}
#info-right {
right: 25px;
text-align: right;
}
#bomb-grab-area {
position: absolute;
width: 30px;
height: 30px;
border-radius: 50%;
background-color: transparent;
cursor: grab;
}
#instructions,
#congratulations {
position: absolute;
transition: visibility 0s, opacity 0.5s linear;
}
@media (min-height: 535px) {
#instructions {
min-height: 200px;
}
}
#congratulations {
background-color: rgba(255, 255, 255, 0.9);
color: black;
padding: 50px 80px;
opacity: 0;
visibility: hidden;
max-width: 300px;
backdrop-filter: blur(5px);
}
#congratulations p a {
color: inherit;
}
#congratulations button {
border: 1px solid rgba(0, 0, 0, 0.9);
color: inherit;
}
#settings {
position: absolute;
top: calc(20px + 16.385px - 10px);
display: flex;
align-items: center;
gap: 10px;
right: 11em;
}
#settings,
#info-left,
#info-right {
animation: fadeInAnimation ease 6s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
}
@media (max-width: 450px) {
#settings,
#info-left,
#info-right {
opacity: 0;
}
#instructions {
visibility: hidden;
}
}
/* Basic CSS for the dropdown */
.dropdown {
position: relative;
display: inline-block;
}
.dropbtn:after {
content: "▼";
margin-left: 7px;
font-size: 0.8em;
vertical-align: text-top;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 120px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
white-space: nowrap;
font-size: 0.9em;
}
.dropdown-content a:hover {
background-color: #f1f1f1;
}
/* Show dropdown content when hovering over the button */
.dropdown:hover .dropdown-content {
display: block;
}
#windmill {
position: absolute;
right: 0;
fill: rgba(255, 255, 255, 0.5);
transform-origin: bottom;
}
#windmill-head {
animation-name: rotate;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
#wind-info {
position: absolute;
width: 100px;
text-align: center;
margin-bottom: 30px;
}
#youtube,
#youtube-card {
display: none;
}
@media (min-height: 425px) {
/** Youtube logo by https://codepen.io/alvaromontoro */
#youtube {
z-index: 2;
display: block;
width: 30px;
height: 21px;
background: red;
position: relative;
border-radius: 50% / 11%;
transition: transform 0.5s;
color: black;
}
#youtube:hover,
#youtube:focus {
transform: scale(1.2);
}
#youtube::before {
content: "";
display: block;
position: absolute;
top: 7.5%;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0