当前位置:   article > 正文

Web前端期末大作业---HTML+CSS+JS实现实现捉虫小游戏_web捉虫游戏体验

web捉虫游戏体验

目录

网页截图展示:文末获取源码

项目源码结构:图片和js以及css等基础文件代码实现

主要源码展示:

获取完整源码:


网页截图展示:

首页展示: 

 选择昆虫:

效果展示:

有密集恐惧症的别玩哟、游戏永远不会停止  一直玩

项目源码结构:图片和js以及css等基础文件代码实现

主要源码展示:

index.html:引入图片和css文件以及js

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>insect-catch-game</title>
  8. <link rel="stylesheet" href="./style.css">
  9. </head>
  10. <body>
  11. <div id="tab-container" class="tab-container">
  12. <div class="tab-item active" data-value="en">en</div>
  13. <div class="tab-item" data-value="zh">zh</div>
  14. </div>
  15. <div class="screen">
  16. <h1 id="firstTitle">Catch The Insect</h1>
  17. <button id="play" class="btn play">Play Game</button>
  18. </div>
  19. <div class="screen">
  20. <h2 id="secondTitle">What is your "favorite" insect?</h2>
  21. <ul id="inspect-list" class="inspect-list">
  22. <li>
  23. <div class="choose-btn">
  24. <p>Fly</p>
  25. <img src="img/fly_PNG3946.png" alt="fly">
  26. </div>
  27. </li>
  28. <li>
  29. <div class="choose-btn">
  30. <p>mosquito</p>
  31. <img src="img/mosquito_PNG18175.png" alt="mosquito" />
  32. </div>
  33. </li>
  34. <li>
  35. <div class="choose-btn">
  36. <p>spider</p>
  37. <img src="img/spider_PNG12.png" alt="spider" />
  38. </div>
  39. </li>
  40. <li>
  41. <div class="choose-btn">
  42. <p>roach</p>
  43. <img src="img/roach_PNG12163.png" alt="roach" />
  44. </div>
  45. </li>
  46. </ul>
  47. </div>
  48. <div class="screen game-container" id="game-container">
  49. <h3 id="time" class="time">Time:<span>00:00</span></h3>
  50. <h3 class="score" id="score">Score:<span>0</span></h3>
  51. <h5 id="message" class="message">
  52. Tell you a bad news, will you be angry? <br> Actually you are playing a game that never ends!!
  53. <button class="btn continue-btn" id="continue">Continue Play</button>
  54. <button class="btn restart-btn" id="restart">Restart Play</button>
  55. </h5>
  56. </div>
  57. </body>
  58. <script src="./data.js"></script>
  59. <script src="./script.js"></script>
  60. </html>

部分style.css样式布局

  1. @import url('https://fonts.googleapis.com/css?family=Press+Start+2P&display=swap');
  2. * {
  3. margin: 0;
  4. padding: 0;
  5. box-sizing: border-box;
  6. }
  7. body {
  8. color: #fff;
  9. text-align: center;
  10. font-family: 'Press Start 2P', sans-serif;
  11. overflow: hidden;
  12. background: linear-gradient(135deg, #9cc8e9 10%, #0b6be0 90%);
  13. min-height: 100vh;
  14. }
  15. .screen {
  16. display: flex;
  17. justify-content: center;
  18. align-items: center;
  19. flex-direction: column;
  20. width: 100vw;
  21. height: 100vh;
  22. transition: all .4s cubic-bezier(0.165, 0.84, 0.44, 1);
  23. position: relative;
  24. overflow: hidden;
  25. }
  26. .screen.hidden {
  27. margin-top: -100vh;
  28. }
  29. .screen h1,
  30. .screen h2 {
  31. letter-spacing: 2px;
  32. margin-bottom: 1rem;
  33. line-height: 1.5;
  34. }
  35. .screen .btn {
  36. background: linear-gradient(135deg, #dfe0e2 10%, #f6f7f7 90%);
  37. outline: none;
  38. border-radius: 8px;
  39. padding: .8rem 4rem;
  40. color: #2396ef;
  41. display: inline-block;
  42. border: 1px solid transparent;
  43. letter-spacing: 2px;
  44. cursor: pointer;
  45. font-size: 18px;
  46. }
  47. .screen .btn.play {
  48. margin-top: 1rem;
  49. }

作品来自于网络收集、侵权立删 

获取源码:

 大家点赞、收藏、关注、评论啦 、

打卡 文章 更新 108/  365天

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/120247
推荐阅读
相关标签
  

闽ICP备14008679号