three实现三维愤怒小鸟射击游戏代码

代码语言:html

所属分类:游戏

代码描述:three实现三维愤怒小鸟射击游戏代码

代码标签: three 三维 愤怒 小鸟 射击 游戏 代码

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

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>三维愤怒的小鸟 - Three.js</title>
<style>
  html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #87ceeb;
    font-family: "Microsoft YaHei", Arial, sans-serif;
  }

  #ui {
    position: fixed;
    top: 14px;
    left: 14px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,.55);
    user-select: none;
    pointer-events: none;
    z-index: 10;
  }

  #ui .panel {
    background: rgba(0,0,0,.35);
    padding: 10px 14px;
    border-radius: 14px;
    backdrop-filter: blur(4px);
    font-size: 16px;
    line-height: 1.8;
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
  }

  #title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
  }

  #tip {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,.35);
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 14px;
    z-index: 10;
    pointer-events: none;
    text-shadow: 1px 1px 2px rgba(0,0,0,.45);
    white-space: nowrap;
  }

  #message {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.45);
    z-index: 20;
  }

  #message .box {
    background: rgba(18,28,38,.92);
    color: #fff;
    padding: 34px 52px;
    border-radius: 22px;
    text-align: center;
    box-shadow: 0 18px 60px rgba(0,0,0,.45);
    border: 1px solid rgba(255,255,255,.08);
  }

  #message h1 {
    margin: 0 0 10px;
    font-size: 44px;
  }

  #message p {
    margin: 0 0 24px;
    font-size: 18px;
    color: #ddd;
  }

  #restartBtn {
    pointer-events: auto;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(#ffd54f, #ff9800);
    color: #5d3a00;
    box-shadow: 0 8px 20px rgba(255,152,0,.35);
  }

  #restartBtn:hover {
    filter: brightness(1.06);
  }

  canvas {
    display: block;
  }
</style>
</head>
<body>

<div id="ui">
  <div class="panel">
    <div id="title">🐦 三维愤怒的小鸟</div>
    得分:<span id="score">0</span><br>
    剩余小鸟:<span id="birds">3</span><br>
    剩余小猪:<span id="pigs">0</span>
  </div>
</div>

<div id="tip">左键拖拽小鸟向后拉弹弓,松开发射;右键拖动旋转视角,滚轮缩放,R 键重开</div>

<div id="message">
  <div class="box">
    <h1 id="msgTitle"></h1>
    <p id="msgText"></p>
    <button id="restartBtn">重新开始</button>
  </div>
<.........完整代码请登录后点击上方下载按钮下载查看

网友评论0