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>操场跨栏比赛</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Microsoft YaHei', sans-serif;
overflow: hidden;
background: #1a1a2e;
}
#gameCanvas {
display: block;
}
/* 游戏UI */
.game-ui {
position: fixed;
top: 0;
left: 0;
right: 0;
padding: 20px;
z-index: 100;
pointer-events: none;
}
.score-board {
display: flex;
justify-content: center;
gap: 20px;
flex-wrap: wrap;
}
.player-score {
background: rgba(0,0,0,0.7);
padding: 10px 20px;
border-radius: 10px;
display: flex;
align-items: center;
gap: 10px;
border: 2px solid;
}
.player-score .avatar {
width: 30px;
height: 30px;
border-radius: 50%;
}
.player-score .name {
font-weight: bold;
color: #fff;
}
.player-score .progress {
font-size: 0.9em;
color: #aaa;
}
.player-score.player { border-color: #00ff88; }
.player-score.ai1 { border-color: #ff6b6b; }
.player-score.ai2 { border-color: #4ecdc4; }
.player-score.ai3 { border-color: #ffe66d; }
/* 控制提示 */
.controls-hint {
position: fixed;
bottom: 30px;
left: 50%;
transform: translateX(-50%);
background: rgba(0,0,0,0.8);
padding: 15px 30px;
border-radius: 50px;
color: #fff;
z-index: 100;
display: flex;
gap: 30px;
align-items: center;
}
.controls-hint .key {
display: inline-block;
background: #333;
padding: 8px 15px;
border-radius: 8px;
border: 2px solid #555;
font-weight: bold;
margin-right: 8px;
}
/* 开始界面 */
.start-screen {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
z-index: 200;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
transition: opacity 0.5s, visibility 0.5s;
}
.start-screen.hidden {
opacity: 0;
visibility: hidden;
}
.start-screen h1 {
font-size: 4em;
color: #00ff88;
text-shadow: 0 0 30px rgba(0,255,136,0.5);
margin-bottom: 20px;
}
.start-screen p {
color: #aaa;
font-size: 1.2em;
margin-bottom: 40px;
}
.start-btn {
background: linear-gradient(135deg, #00ff88, #00cc6a);
border: none;
padding: 20px 60px;
font-size: 1.5em;
color: #000;
font-weight: bold;
border-radius: 50px;
cursor: pointer;
transition: transform 0.3s, box-shadow 0.3s;
}
.start-btn:hover {
transform: scale(1.1);
box-shadow: 0 0 40px rgba(0,255,136,0.6);
}
.runners-preview {
display: flex;
gap: 30px;
margin-top: 50px;
}
.runner-card {
text-align: center;
padding: 20px;
background: rgba(255,255,255,0.05);
border-radius: 15px;
border: 2px solid rgba(255,255,255,0.1);
}
.runner-card .icon {
font-size: 3em;
margin-bottom: 10px;
}
.runner-card .runner-name {
color: #fff;
font-weight: bold;
}
/* 结果界面 */
.result-screen {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.9);
z-index: 200;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: opacity 0.5s, visibility 0.5s;
}
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0