本文实例为大家分享了jQuery实现飞机大战的具体代码,供大家参考,具体内容如下
游戏规则:
WSAD键控制大飞机移动方向,按下J键可发射子弹消灭敌机,每歼灭一架敌机可得10分;
与敌机相撞或者有遗漏敌机没有歼灭,则游戏结束
游戏显示如下图:
css部分:
<style> .container { width: 800px; height: 500px; margin: 10vh auto; background: #000; position: relative; overflow: hidden; } .plane { color: #fff; width: 70px; height: 70px; position: absolute; bottom: 10px; left: calc(50% - 30px); background: url(img/战斗机.png) no-repeat; background-size: 70px 70px; } .bullet { width: 25px; height: 30px; background: url(img/子弹.png) no-repeat; background-size: 100% 100%; position: absolute; } .enemy { width: 40px; height: 40px; background: url(img/战斗机.png) no-repeat; transform: rotate(180deg); background-size: 100% 100%; position: absolute; top: 0; } .again { width: 220px; height: 160px; border: 1px solid #ccc; box-shadow: 5px 5px #ccc; background: rgb(252, 187, 187); text-align: center; line-height: 80px; color: #fff; font-size: 20px; position: absolute; top: calc(50% - 80px); left: calc(50% - 110px); margin: 0 auto; cursor: pointer; } i { font-style: normal; } .sorce { height: 30px; font-size: 20px; text-align: center; font-weight: bold; margin: 0 auto; position: absolute; top: 65px; left: calc(50% - 100px); color: #fff; z-index: 100; background: linear-gradient(to right, rgb(255, 163, 220), rgb(243, 176, 213)); -webkit-background-clip: text; color: transparent; } </style>
html部分:
<div class="sorce"> 击败:<i class="ok">0</i> 得分:<i class="get">0</i> </div> <div class="container"> <div class="plane"> </div> </div>
js部分:
<script src="/UploadFiles/2021-04-02/jquery.min.js">更多有趣的经典小游戏实现专题,分享给大家:
C++经典小游戏汇总
python经典小游戏汇总
python俄罗斯方块游戏集合
JavaScript经典游戏 玩不停
java经典小游戏汇总
javascript经典小游戏汇总
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com
暂无评论...
更新日志
2024年09月23日
2024年09月23日
- Merryland《Merryland》[320K/MP3][69.48MB]
- 苏芮.1991-停在我心里的温柔【福茂】【WAV+CUE】
- 苏慧伦.2020-面面Every.Side.of.Me【相信音乐】【WAV+CUE】
- 群星.1991-不一样的感觉REMIX【宝丽金】【WAV+CUE】
- 银霞.1983-《你那好冷的小手》珍藏纪念版[WAV分轨]
- 银霞.2002-《国语巨星专辑VOL.3》2CD台湾版[WAV+CUE]
- 金池刘罡《昨日情歌HQ》头版限量编号[低速原抓WAV+CUE]
- 段奥娟.2024-23·岁碎念【白米范】【FLAC分轨】
- 顺子.2001-昨日·唯一·更多·顺子自选辑【魔岩】【WAV+CUE】
- 无印良品.1999-私藏三首·原创相对论(EP)【滚石】【WAV+CUE】
- Merryland《Merryland》[FLAC/分轨][170.22MB]
- 庄锭欣 ELKIE《没有你的未来》[320K/MP3][15.78MB]
- 庄锭欣 ELKIE《没有你的未来》[FLAC/分轨][36MB]
- TchaikovskySwanLake,Op.20柴可夫斯基天鹅湖(2013)SACD[Hi-Res]
- 24bit达人艺典《琴歌终极版》整轨WAV+CUE