jquery+TweenMax实现一个变色弹球跳台阶小游戏代码

代码语言:html

所属分类:其他

代码描述:jquery+TweenMax实现一个变色弹球跳台阶小游戏代码,基于jQuery和TweenMax技术构建的网页小游戏,名为“变色弹球跳台阶”。游戏中,玩家控制一个不断改变颜色的弹跳球,通过点击屏幕上的栏杆来切换球的颜色,使其与栏杆的颜色匹配。玩家需要精准地点击栏杆,确保球在跳跃过程中始终与栏杆颜色一致,以顺利通过每一级台阶。这款游戏结合了颜色识别和反应速度的挑战,为玩家提供了一种既有趣又具挑战性的娱乐体验。

代码标签: jquery TweenMax 变色 弹球 台阶 游戏 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
   
<meta charset="UTF-8">
   
<title>变色弹球跳台阶</title>
   
<meta charset="utf-8">
   
<meta http-equiv="x-ua-compatible" content="ie=edge">

   
<meta property="og:site_name" content="CodePen">
   
<meta property="og:description" content="A game made to inspire developers to use GSAP, ES6 and Flexbox">
<style>
    .bubble {
  border-radius: 50%;
  position: absolute;
  background-color: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  border-width: 4px;
}

.bubble-1 {
  height: 15px;
  width: 15px;
  top: 21px;
  left: 59px;
}

.bubble-2 {
  height: 27px;
  width: 27px;
  top: 36px;
  left: 16px;
}

.bubble-3 {
  height: 21px;
  width: 21px;
  top: 63px;
  left: 49px;
}

.bubble-4 {
  height: 15px;
  width: 15px;
  top: 98px;
  left: 37px;
}

.bubble-5 {
  height: 5px;
  width: 5px;
  top: 116px;
  left: 20px;
  background-color: transparent;
  border-style: solid;
}

.bubble-6 {
  height: 6px;
  width: 6px;
  top: 128px;
  left: 63px;
}

.bubble-7 {
  height: 27px;
  width: 27px;
  top: 150px;
  left: 52px;
}

.bubble-8 {
  height: 19px;
  width: 19px;
  top: 154px;
  left: 18px;
}

.bubble-9 {
  height: 10px;
  width: 10px;
  top: 189px;
  left: 13px;
}

.bubble-10 {
  height: 5px;
  width: 5px;
  top: 199px;
  left: 52px;
  background-color: transparent;
  border-style: solid;
}

.bubble-11 {
  height: 21px;
  width: 21px;
  top: 220px;
  left: 29px;
}

.bubble-12 {
  height: 21px;
  width: 21px;
  top: 263px;
  left: 48px;
}

.bubble-13 {
  height: 5px;
  width: 5px;
  top: 275px;
  left: 16px;
  background-color: transparent;
  border-style: solid;
}

.bubble-14 {
  height: 15px;
  width: 15px;
  top: 296px;
  left: 34px;
}

.triangle {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
}

.triangle-1 {
  border-radius: 50%;
  position: absolute;
  background-color: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  border-width: 4px;
  height: 10px;
  width: 10px;
  top: 22px;
  left: 55px;
}

.triangle-2 {
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 14px solid rgba(0, 0, 0, 0.12);
  background-color: transparent;
  left: 15px;
  top: 27px;
}
.triangle-2:after {
  content: " ";
  display: block;
  position: absolute;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-bottom: 5px solid transparent;
  top: 6px;
  left: -3.5px;
  transition: border-bottom-color 0.4s ease;
}
.red .triangle-2:after {
  border-bottom-color: #fc5c82;
}
.yellow .triangle-2:after {
  border-bottom-color: #fcd45c;
}
.purple .triangle-2:after {
  border-bottom-color: #9174f5;
}

.triangle-3 {
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 19px solid rgba(0, 0, 0, 0.12);
  background-color: transparent;
  left: 43px;
  top: 60px;
}
.triangle-3:after {
  content: " ";
  display: block;
  position: absolute;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid transparent;
  top: 6px;
  left: -4.75px;
  transition: border-bottom-color 0.4s ease;
}
.red .triangle-3:after {
  border-bottom-color: #fc5c82;
}
.yellow .triangle-3:after {
  border-bottom-color: #fcd45c;
}
.purple .triangle-3:after {
  border-bottom-color: #9174f5;
}

.triangle-4 {
  border-radius: 50%;
  position: absolute;
  background-color: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  border-width: 3px;
  height: 8px;
  width: 8px;
  top: 61px;
  left: 17px;
  background-color: transparent;
  border-style: solid;
}

.triangle-5 {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 8px solid rgba(0, 0, 0, 0.12);
  background-color: transparent;
  left: 25px;
  top: 101px;
  transform: rotate(180deg);
}

.triangle-6 {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid rgba(0, 0, 0, 0.12);
  background-color: transparent;
  left: 60px;
  top: 103px;
  transform: rotate(-90deg);
}

.triangle-7 {
  border-left: 12.5px solid transparent;
  border-right: 12.5px solid transparent;
  border-bottom: 19px solid rgba(0, 0, 0, 0.12);
  background-color: transparent;
  left: 17px;
  top: 126px;
  transform: rotate(180deg);
}

.triangle-8 {
  border-left: 10.5px solid transparent;
  border-right: 10.5px solid transparent;
  border-bottom: 16px solid rgba(0, 0, 0, 0.12);
  background-color: transparent;
  left: 50px;
  top: 149px;
}

.triangle-9 {
  border-left: 5.5px solid transparent;
  border-right: 5.5px solid transparent;
  border-bottom: 8px solid rgba(0, 0, 0, 0.12);
  background-color: transparent;
  left: 21px;
  top: 177px;
}

.triangle-10 {
  border-radius: 50%;
  position: absolute;
  background-color: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  border-width: 4px;
  height: 10px;
  width: 10px;
  top: 177px;
  left: 60px;
}

.triangle-11 {
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 13px solid rgba(0, 0, 0, 0.12);
  background-color: transparent;
  left: 33px;
  top: 213px;
  transform: rotate(180deg);
}

.triangle-12 {
  border-radius: 50%;
  position: absolute;
  background-color: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  border-width: 2px;
  height: 10px;
  width: 10px;
  top: 233px;
  left: 65px;
  background-color: transparent;
  border-style: solid;
}

.triangle-13 {
  border-radius: 50%;
  position: absolute;
  background-color: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  border-width: 4px;
  height: 10px;
  width: 10px;
  top: 250px;
  left: 22px;
}

.triangle-14 {
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 14px solid rgba(0, 0, 0, 0.12);
  background-color: transparent;
  left: 45px;
  top: 270px;
  transform: rotate(180deg);
}
.triangle-14:after {
  content: " ";
  display: block;
  position: absolute;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-bottom: 5px solid transparent;
  top: 6px;
  left: -3.5px;
  transition: border-bottom-color 0.4s ease;
}
.red .triangle-14:after {
  border-bottom-color: #fc5c82;
}
.yellow .triangle-14:after {
  border-bottom-color: #fcd45c;
}
.purple .triangle-14:after {
  border-bottom-color: #9174f5;
}

.stick .block {
  position: absolute;
  overflow: hidden;
  z-index: 999;
  border-radius: 7px;
}
.stick .block .inner {
  border-radius: 7px;
  background-color: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.12);
  border-width: 3px;
  height: 100%;
  width: 100%;
  position: absolute;
}
.stick .block:nth-child(2n+1) .inner-2 {
  left: -200%;
}
.stick .block:nth-child(2n+2) .inner-2 {
  left: 200%;
}
.stick .block-1 {
  height: 16px;
  width: 31px;
  top: 16px;
  left: 30px;
}
.stick .block-1 .inner {
  background-color: transparent !important;
  border-style: solid;
  box-sizing: border-box;
}
.stick .block-2 {
  height: 14px;
  width: 42px;
  top: 50px;
  left: 15px;
}
.stick .block-3 {
  height: 18px;
  width: 9px;
  top: 73px;
  left: 64px;
}
.stick .block-4 {
  height: 9px;
  width: 14px;
  top: 84px;
  left: 26px;
}
.stick .block-5 {
  height: 15px;
  width: 15px;
  top: 109px;
  left: 45px;
}
.stick .block-5 .inne.........完整代码请登录后点击上方下载按钮下载查看

网友评论0