jQuery实现简单飞机大战
(编辑:jimmy 日期: 2025/10/25 浏览:3 次 )
本文实例为大家分享了jQuery实现飞机大战的具体代码,供大家参考,具体内容如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>飞机大战</title>
<style>
* {
margin: 0px
}
.container {
height: 700px;
width: 500px;
background-color: black;
margin: 5px auto; /*上下外边距5px,左右自动*/
position: relative;
}
.plane {
height: 80px;
width: 80px;
/*background:bg-color bg-image position/bg-size bg-repeat bg-origin bg-clip bg-attachment initial|inherit;
*/
background: url(images/plane.png) no-repeat center / 100% 100%;
position: absolute;
bottom: 10px;
left: calc(50% - 40px);
}
.bullet {
height: 10px;
width: 5px;
/*border-radius
*每个半径的四个值的顺序是:左上角,右上角,右下角,左下角。
*如果省略左下角,右上角是相同的。如果省略右下角,左上角是相同的。
*如果省略右上角,左上角是相同的。
*/
border-radius: 45% 45% 0 0;
/*box-shadow: h-shadow v-shadow blur spread color inset;
*h-shadow: 必需,水平阴影的位置
*v-shadow: 必需,垂直阴影的位置
*blur: 可选,模糊距离
*spread: 可选,阴影的大小
*color: 可选,阴影的颜色
*inset: 可选,从外层的阴影(开始时)改变阴影内侧阴影
*/
box-shadow: 0px 2px 10px orange;
background: gold;
position: absolute;
}
.enemy {
height: 34.4px;
width: 32.5px;
/*background:bg-color bg-image position/bg-size bg-repeat bg-origin bg-clip bg-attachment initial|inherit;
*/
background: url(images/enemy.png) no-repeat center / 100% 100%;
transform: rotate(180deg);
position: absolute;
overflow: hidden;
top: 0px;
}
h2 {
height: 40px;
display: table;
border-color: deepskyblue;
border-radius: 5px;
background-color: deepskyblue;
text-align: center;
padding: 5px;
position: relative;
float: right;
right: 300px;
}
</style>
<!--引入jQuery-->
<script src="/UploadFiles/2021-04-02/jquery-3.4.1.js">
更多有趣的经典小游戏实现专题,分享给大家:
C++经典小游戏汇总
python经典小游戏汇总
python俄罗斯方块游戏集合
JavaScript经典游戏 玩不停
java经典小游戏汇总
javascript经典小游戏汇总
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
下一篇:javascript实现贪吃蛇小练习