表情包大乱斗 - 新增🙃系统好友
by UltraKoala46540 lines21.7 KB
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>表情包大乱斗 - 新增🙃系统好友</title>
<style>
*{box-sizing:border-box;margin:0;padding:0;font-family:system-ui}
body{overflow:hidden}
/* 主页面 */
#homePage{width:100vw;height:100vh;background:#222831;color:white;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px}
#homePage h1{font-size:30px;color:#ffdd44}
.charSelect{display:flex;gap:10px;margin-bottom:4px;flex-wrap:wrap;justify-content:center}
.charBtn{padding:10px 12px;font-size:16px;border-radius:10px;border:3px solid transparent;background:#393e46;color:white;cursor:pointer}
.charBtn.selected{border-color:#ffdd44;background:#4a4f59}
.dungeonSelect{display:flex;gap:8px;margin:6px 0;flex-wrap:wrap;justify-content:center}
.dungeonBtn{padding:9px 12px;border-radius:8px;border:none;background:#505864;color:white;font-size:15px}
#museumBtn,#shopBtn{padding:9px 16px;border-radius:8px;border:none;color:white;font-size:16px;margin:3px 0}
#museumBtn{background:#238b5c}
#shopBtn{background:#c27820}
#startBtn{padding:11px 26px;font-size:18px;background:#00adb5;border:none;border-radius:9px;color:white;margin-top:4px}
/* 博物馆页面 */
#museumPage{display:none;width:100vw;height:100vh;background:#1b3b2e;color:#fff;padding:16px;overflow:auto}
#museumPage h2{text-align:center;color:#ffdd44}
.museumGrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(100px,1fr));gap:12px;margin-top:16px}
.museumCard{background:#2c5544;padding:12px;border-radius:10px;text-align:center}
.museumCard span{font-size:42px;display:block}
#backFromMuseum{padding:7px 12px;background:#ee5555;border:none;border-radius:7px;color:white;margin-top:8px}
/* 商店页面 */
#shopPage{display:none;width:100vw;height:100vh;background:#2b2218;color:#fff;padding:16px;overflow:auto}
#shopPage h2{text-align:center;color:#ffdd44}
.coinTip{text-align:center;font-size:18px;margin-bottom:10px}
.shopGrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:14px;margin-top:16px}
.shopCard{background:#443828;padding:12px;border-radius:10px;text-align:center}
.shopCard span{font-size:44px;display:block}
.shopCard .buyBtn{margin-top:6px;padding:6px 10px;border:none;border-radius:6px;background:#28a745;color:white}
.shopCard .owned{margin-top:6px;padding:6px 10px;border:none;border-radius:6px;background:#666;color:#ddd}
#backFromShop{padding:7px 12px;background:#ee5555;border:none;border-radius:7px;color:white;margin-top:8px}
/* 对战页面 */
#battlePage{display:none;width:100vw;height:100vh;position:relative;background:#111222;overflow:hidden}
#joystick{position:fixed;bottom:20px;left:20px;width:110px;height:110px;background:rgba(0,0,0,0.4);border-radius:50%}
#stick{width:46px;height:46px;background:#fff;border-radius:50%;position:absolute;left:32px;top:32px}
#skillPanel{position:fixed;bottom:20px;right:20px;display:flex;gap:6px;flex-wrap:wrap;max-width:170px}
.skillBtn{padding:9px;border:none;border-radius:8px;font-size:13px;font-weight:bold}
#trackBtn{display:none;}
#chatBox{position:fixed;top:10px;left:50%;transform:translateX(-50%);background:rgba(0,0,0,0.75);padding:8px 12px;border-radius:8px;font-size:14px;min-height:34px;text-align:center;max-width:92%}
.unit{position:absolute;font-size:52px;user-select:none;transition:0.07s linear}
#player{z-index:3}
#enemy{z-index:2}
#friendUnit{z-index:2;}
.obstacle{position:absolute;font-size:36px;user-select:none}
.bullet{position:absolute;font-size:20px;user-select:none}
.enemyBullet{position:absolute;font-size:18px;user-select:none;color:#ff4444}
#hpBox{position:fixed;top:52px;left:10px;color:#fff;font-size:14px;background:rgba(0,0,0,0.6);padding:6px;border-radius:6px}
#backHome{position:fixed;top:10px;right:10px;padding:6px 10px;border:none;border-radius:6px;background:#ee5555;color:white;font-size:13px}
#dayInfo{position:fixed;top:88px;left:10px;color:white;background:rgba(0,0,0,0.5);padding:4px;border-radius:4px;font-size:13px}
#annoyBar{position:fixed;top:116px;left:10px;color:white;background:rgba(0,0,0,0.5);padding:4px;border-radius:4px;font-size:13px}
#progressTip{position:fixed;top:144px;left:10px;color:white;background:rgba(0,0,0,0.5);padding:4px;border-radius:4px;font-size:13px}
/* 剧情弹窗 */
#storyPopup{position:fixed;inset:0;background:rgba(0,0,0,0.85);display:none;align-items:center;justify-content:center;z-index:999}
#storyBox{width:86%;max-width:560px;background:#222;padding:18px;border-radius:12px;color:#fff;font-size:16px;line-height:1.5}
#nextStoryBtn{margin-top:14px;padding:8px 18px;border:none;border-radius:6px;background:#00adb5;color:white;font-size:15px}
</style>
</head>
<body>
<!-- 主页面 -->
<div id="homePage">
<h1>表情包大乱斗</h1>
<div>选择你的角色</div>
<div class="charSelect">
<button class="charBtn selected" id="selectLaugh">
<span>😁</span>
嘲笑哥
</button>
<button class="charBtn" id="selectYing">
<span>😜</span>
营销号
</button>
<button class="charBtn" id="selectAngry">
<span>😡</span>
愤怒哥
</button>
<button class="charBtn" id="selectEat">
<span>😋</span>
贪吃哥
</button>
</div>
<div style="display:flex;gap:8px;">
<button id="museumBtn">🏝️岛屿博物馆</button>
<button id="shopBtn">🛒飞船商店</button>
</div>
<div>选择副本</div>
<div class="dungeonSelect">
<button class="dungeonBtn" data-map="alien">👽外星飞船逃生</button>
<button class="dungeonBtn" data-map="space">✈️宇宙空战副本</button>
</div>
<button id="startBtn">开始副本</button>
</div>
<!-- 博物馆(岛屿) -->
<div id="museumPage">
<h2>🏝️岛屿 · 角色博物馆</h2>
<div class="museumGrid">
<div class="museumCard"><span>😁</span>嘲笑哥<br>技能:嘲笑</div>
<div class="museumCard"><span>😜</span>营销号<br>技能:盗视频</div>
<div class="museumCard"><span>😡</span>愤怒哥<br>技能:兽来</div>
<div class="museumCard"><span>😋</span>贪吃哥<br>技能:吃掉</div>
<div class="museumCard"><span>🙃</span>系统好友<br>自动帮你打敌人</div>
<div class="museumCard"><span>👽</span>外星人<br>追捕者</div>
<div class="museumCard"><span>☠️</span>骷髅BOSS<br>飞船BOSS</div>
<div class="museumCard"><span>🛸</span>外星战机<br>宇宙敌人</div>
<div class="museumCard"><span>🍎</span>苹果飞船<br>水果战机</div>
</div>
<button id="backFromMuseum">返回主页</button>
</div>
<!-- 飞船商店 -->
<div id="shopPage">
<h2>🛒飞船商店</h2>
<div class="coinTip">💰金币:<span id="coinNum">0</span></div>
<div class="shopGrid" id="shopGrid"></div>
<button id="backFromShop">返回主页</button>
</div>
<!-- 剧情弹窗 -->
<div id="storyPopup">
<div id="storyBox">
<div id="storyText"></div>
<button id="nextStoryBtn">继续</button>
</div>
</div>
<!-- 对战界面 -->
<div id="battlePage">
<button id="backHome">返回主页</button>
<div id="hpBox">玩家血量:<span id="pHp">100</span></div>
<div id="dayInfo">天数:第1天</div>
<div id="annoyBar">敌人烦恼度:0 / 100</div>
<div id="progressTip">提示</div>
<div id="player" class="unit"></div>
<div id="enemy" class="unit">👽</div>
<div id="friendUnit" class="unit">🙃</div>
<div id="obsContainer"></div>
<div id="bulletContainer"></div>
<div id="enemyBulletContainer"></div>
<div id="joystick">
<div id="stick"></div>
</div>
<div id="skillPanel">
<button class="skillBtn" id="attackBtn">👊攻击</button>
<button class="skillBtn" id="skillBtn">专属技能</button>
<button class="skillBtn" id="trackBtn">🎯追踪弹</button>
</div>
<div id="chatBox">准备开始副本剧情!</div>
</div>
<script>
const home = document.getElementById("homePage")
const museum = document.getElementById("museumPage")
const shopPage = document.getElementById("shopPage")
const battle = document.getElementById("battlePage")
const player = document.getElementById("player")
const enemy = document.getElementById("enemy")
const friendUnit = document.getElementById("friendUnit")
const msgBox = document.getElementById("chatBox")
const pHpText = document.getElementById("pHp")
const storyPopup = document.getElementById("storyPopup")
const storyText = document.getElementById("storyText")
const nextStoryBtn = document.getElementById("nextStoryBtn")
const dayInfo = document.getElementById("dayInfo")
const annoyBar = document.getElementById("annoyBar")
const progressTip = document.getElementById("progressTip")
const obsContainer = document.getElementById("obsContainer")
const bulletContainer = document.getElementById("bulletContainer")
const enemyBulletContainer = document.getElementById("enemyBulletContainer")
const shopGrid = document.getElementById("shopGrid")
const coinNum = document.getElementById("coinNum")
const trackBtn = document.getElementById("trackBtn")
//飞船商店数据
const shipList = [
{id:"normal",emoji:"✈️",name:"普通飞机",price:0},
{id:"traffic",emoji:"🚦",name:"红绿灯飞船",price:80},
{id:"taxi",emoji:"🚕",name:"出租车飞船",price:60},
{id:"apple",emoji:"🍎",name:"苹果飞船",price:90},
]
let coins = 0
let ownedShips = ["normal"]
let selectedShip = "normal"
//角色数据,新增贪吃哥😋
const charList = {
laugh: {emoji:"😁",name:"嘲笑哥",skillName:"嘲笑",lines:["你好菜!","你根本打不过我!","你动作好慢!"],skillDesc:"嘲笑敌人,敌人破防减速"},
yingxiao: {emoji:"😜",name:"营销号",skillName:"盗视频",lines:["我把你的视频偷走啦!"],skillDesc:"盗视频,你吐槽,他越来越强"},
angry: {emoji:"😡",name:"愤怒哥",skillName:"兽来",lines:["感受烦恼!","无尽的烦恼包围你!"],skillDesc:"增加敌人烦恼度,满100直接烦死敌人"},
eat: {emoji:"😋",name:"贪吃哥",skillName:"吃掉",lines:["啊呜一口!","进肚子里吧!"],skillDesc:"把敌人吞进肚子困住10秒,时间到敌人逃出,玩家扣7血(肚皮破了)"}
}
let selectedChar = charList.laugh
let selectedMap = "alien"
let day = 1
let enemyAnnoy = 0
let gameRunning = false
let bossMode = false
let obstacles = []
let bullets = []
let enemyBullets = []
let endX = window.innerWidth - 120
let spaceMode = false
let enemyTrapped = false
let trapTimer = null
//好友🙃系统
let fx = 200, fy = 300
//两套剧情
const storyAlien = [
"【新手教程】摇杆移动,攻击键普攻,技能释放专属能力!追踪弹只有宇宙副本解锁!",
"第1天:出门探索,在飞船走廊遇见👽外星人!",
"👽外星人抓住了你,抓到实验室!",
"你被注入神秘物质,解锁专属技能!",
"第2天:逃离外星飞船!向右躲避障碍,外星人追你骚扰,跑到终点触发☠️BOSS战!"
]
const storySpace = [
"【新手教程】宇宙空战!解锁🎯追踪弹!摇杆控制移动!",
"第2天:你成功甩开外星人追捕,发现一架飞机!",
"你登上飞船,启动引擎冲上天空!",
"一路向上,冲出大气层,来到浩瀚宇宙!",
"宇宙副本开启!击落🛸外星战机!追踪弹可以锁定敌人!"
]
let storyScript = storyAlien
let storyIndex = 0
//渲染商店
function renderShop(){
shopGrid.innerHTML = ""
coinNum.innerText = coins
shipList.forEach(ship=>{
const card = document.createElement("div")
card.className = "shopCard"
const isOwn = ownedShips.includes(ship.id)
const isSelected = selectedShip === ship.id
card.innerHTML = `
<span>${ship.emoji}</span>
<div>${ship.name}</div>
<div>${ship.price===0?"免费":"💰"+ship.price}</div>
`
const btn = document.createElement("button")
if(isOwn){
if(isSelected){
btn.innerText = "✅已装备"
btn.className = "owned"
}else{
btn.innerText = "装备"
btn.className = "buyBtn"
btn.onclick = ()=>{
selectedShip = ship.id
renderShop()
}
}
}else{
btn.innerText = "购买"
btn.className = "buyBtn"
btn.onclick = ()=>{
if(coins >= ship.price){
coins -= ship.price
ownedShips.push(ship.id)
selectedShip = ship.id
renderShop()
}else{
alert("金币不够!打完副本获得金币!")
}
}
}
card.appendChild(btn)
shopGrid.appendChild(card)
})
}
renderShop()
//角色选择
const laughBtn = document.getElementById("selectLaugh")
const yingBtn = document.getElementById("selectYing")
const angryBtn = document.getElementById("selectAngry")
const eatBtn = document.getElementById("selectEat")
laughBtn.onclick = ()=>{selectedChar=charList.laugh;laughBtn.classList.add("selected");yingBtn.classList.remove("selected");angryBtn.classList.remove("selected");eatBtn.classList.remove("selected")}
yingBtn.onclick = ()=>{selectedChar=charList.yingxiao;yingBtn.classList.add("selected");laughBtn.classList.remove("selected");angryBtn.classList.remove("selected");eatBtn.classList.remove("selected")}
angryBtn.onclick = ()=>{selectedChar=charList.angry;angryBtn.classList.add("selected");laughBtn.classList.remove("selected");yingBtn.classList.remove("selected");eatBtn.classList.remove("selected")}
eatBtn.onclick = ()=>{selectedChar=charList.eat;eatBtn.classList.add("selected");laughBtn.classList.remove("selected");yingBtn.classList.remove("selected");angryBtn.classList.remove("selected")}
//博物馆、商店页面跳转
document.getElementById("museumBtn").onclick = ()=>{home.style.display="none";museum.style.display="block"}
document.getElementById("backFromMuseum").onclick = ()=>{museum.style.display="none";home.style.display="flex"}
document.getElementById("shopBtn").onclick = ()=>{home.style.display="none";shopPage.style.display="block";renderShop()}
document.getElementById("backFromShop").onclick = ()=>{shopPage.style.display="none";home.style.display="flex"}
//副本选择
document.querySelectorAll(".dungeonBtn").forEach(btn=>{
btn.onclick=()=>{
selectedMap=btn.dataset.map
document.querySelectorAll(".dungeonBtn").forEach(b=>b.style.background="#505864")
btn.style.background="#00adb5"
}
})
//剧情翻页
nextStoryBtn.onclick = ()=>{
storyIndex++
if(storyIndex >= storyScript.length){
storyPopup.style.display = "none"
startGame()
return
}
storyText.innerText = storyScript[storyIndex]
}
//返回主页
document.getElementById("backHome").onclick = ()=>{battle.style.display="none";home.style.display="flex";gameRunning=false;clearTimeout(trapTimer)}
//开始副本
document.getElementById("startBtn").onclick = ()=>{
home.style.display = "none"
battle.style.display = "block"
if(selectedMap==="space"){
storyScript=storySpace
spaceMode=true
battle.style.background="#080820"
trackBtn.style.display="block"
}else{
storyScript=storyAlien
spaceMode=false
battle.style.background="#111222"
trackBtn.style.display="none"
}
storyIndex=0
storyText.innerText=storyScript[0]
storyPopup.style.display="flex"
}
let px = 80, py = 250
let ex = 300, ey = 250
let spd = 4
let dx = 0, dy = 0
let enemyHp = 100
let playerHp = 100
let yingConfidence = 0
function getShipEmoji(){
const s = shipList.find(x=>x.id===selectedShip)
return s.emoji
}
function startGame(){
gameRunning = true
bossMode = false
enemyAnnoy = 0
enemyTrapped = false
clearTimeout(trapTimer)
day = 2
dayInfo.innerText = "天数:"+day
player.innerText = spaceMode ? getShipEmoji() : selectedChar.emoji
enemy.innerText = spaceMode ? "🛸" : "👽"
friendUnit.innerText = "🙃"
fx = px + 100
fy = py
px = 80; py = 250
ex = 500; ey = 220
enemyHp=100
playerHp = 100
yingConfidence=0
bullets=[];enemyBullets=[]
bulletContainer.innerHTML="";enemyBulletContainer.innerHTML=""
updateHp()
updateAnnoy()
if(spaceMode){
progressTip.innerText="宇宙空战!击落外星战机🛸"
msgBox.innerText="宇宙!小心敌方子弹!🙃好友帮你战斗!"
obsContainer.innerHTML=""
}else{
progressTip.innerText="逃生:向右跑,到达终点触发BOSS"
msgBox.innerText="第2天,逃离飞船!躲开障碍!🙃好友跟着你!"
obsContainer.innerHTML=""
obstacles=[]
for(let i=0;i<8;i++){
const t=document.createElement("div")
t.className="obstacle";t.innerText="🪨"
const tx=220+i*110, ty=80+Math.random()*(window.innerHeight-220)
t.style.left=tx+"px";t.style.top=ty+"px"
obsContainer.appendChild(t)
obstacles.push({dom:t,x:tx,y:ty})
}
}
}
function updateHp(){pHpText.innerText = Math.max(0,playerHp)}
function updateAnnoy(){annoyBar.innerText = "敌人烦恼度:"+enemyAnnoy+" / 100 "}
//摇杆
const joy = document.getElementById("joystick")
const stick = document.getElementById("stick")
let joyActive = false
joy.addEventListener("touchstart",e=>{joyActive=true})
joy.addEventListener("touchmove",e=>{
if(!joyActive)return
const rect = joy.getBoundingClientRect()
const cx = rect.left+rect.width/2
const cy = rect.top+rect.height/2
let tx = e.touches[0].clientX-cx
let ty = e.touches[0].clientY-cy
const dist = Math.hypot(tx,ty)
if(dist>35){tx=tx/dist*35;ty=ty/dist*35}
stick.style.left=35+tx+"px";stick.style.top=35+ty+"px"
dx=tx/35;dy=ty/35
})
joy.addEventListener("touchend",()=>{joyActive=false;stick.style.left="35px";stick.style.top="35px";dx=0;dy=0})
//普通子弹
document.getElementById("attackBtn").onclick = ()=>{
if(!gameRunning)return
const b = document.createElement("div")
b.className="bullet";b.innerText="•"
b.style.left=px+30+"px";b.style.top=py+28+"px"
bulletContainer.appendChild(b)
bullets.push({dom:b,x:px+30,y:py+28,vx:7,vy:0})
}
//追踪弹
document.getElementById("trackBtn").onclick = ()=>{
if(!gameRunning)return
const b = document.createElement("div")
b.className="bullet";b.innerText="🎯"
b.style.left=px+30+"px";b.style.top=py+28+"px"
bulletContainer.appendChild(b)
bullets.push({dom:b,x:px+30,y:py+28,isTrack:true})
}
//专属技能
document.getElementById("skillBtn").onclick = ()=>{
if(!gameRunning)return
const line = selectedChar.lines[Math.floor(Math.random()*selectedChar.lines.length)]
if(selectedChar === charList.laugh){
msgBox.innerText = `😁嘲笑哥:${line}`
enemyHp -= 18
setTimeout(()=>{msgBox.innerText="敌人破防,移动变慢!";spd=2.5;setTimeout(()=>spd=4,3000)},500)
}else if(selectedChar === charList.yingxiao){
msgBox.innerText = `😜营销号:${line}`
playerHp -=15;yingConfidence+=25
setTimeout(()=>msgBox.innerText="💬你吐槽!营销号越来越强!",500)
}else if(selectedChar === charList.angry){
msgBox.innerText = `😡愤怒哥:${line}`
enemyAnnoy +=30;updateAnnoy()
if(enemyAnnoy>=100){enemyHp=0;msgBox.innerText="💥敌人被烦恼淹没! "}
}else if(selectedChar === charList.eat){
if(enemyTrapped){
msgBox.innerText="❌肚子里已经有敌人啦!等他跑出来!"
return
}
const dis = Math.hypot(px-ex,py-ey)
if(dis>120){
msgBox.innerText="❌离太远,吃不到!靠近敌人!"
return
}
msgBox.innerText = `😋贪吃哥:${line}`
enemyTrapped=true
enemy.style.display="none"
msgBox.innerText="✅敌人被吞进肚子里!困住10秒!"
trapTimer = setTimeout(()=>{
enemyTrapped=false
enemy.style.display="block"
playerHp -=7
updateHp()
msgBox.innerText="💥肚皮破啦!敌人跑出来,你扣7血!"
checkWin()
},10000)
}
enemy.style.filter="brightness(0.6)";setTimeout(()=>enemy.style.filter="",400)
checkWin()
}
function checkWin(){
if(enemyAnnoy >=100 && !bossMode){
gameRunning=false;msgBox.innerText="🎉愤怒哥胜利!获得30金币!";coins+=30;renderShop();return
}
if(enemyHp <=0 && bossMode){
gameRunning=false;msgBox.innerText="🎉通关!获得50金币!";coins+=50;renderShop();return
}
if(enemyHp <=0 && spaceMode){
gameRunning=false;msgBox.innerText="🎉你击落外星战机,宇宙副本通关!获得60金币!";coins+=60;renderShop();return
}
if(playerHp <=0){
gameRunning=false;msgBox.innerText="💀你被打败了!";return
}
}
//游戏循环
function loop(){
if(!gameRunning){requestAnimationFrame(loop);return}
px += dx*spd; py += dy*spd
px = Math.max(0,Math.min(window.innerWidth-70,px))
py = Math.max(0,Math.min(window.innerHeight-80,py))
player.style.left = px + "px"; player.style.top = py + "px"
//🙃好友逻辑:跟着玩家,自动打敌人
const fdx = px - fx
const fdy = py - fy
const fDist = Math.hypot(fdx,fdy)
if(fDist > 90){
fx += fdx/fDist * 2.8
fy += fdy/fDist * 2.8
}
friendUnit.style.left = fx + "px"; friendUnit.style.top = fy + "px"
//好友自动发射子弹
if(!enemyTrapped && Math.random() < 0.025){
const b = document.createElement("div")
b.className="bullet";b.innerText="•"
b.style.left=fx+30+"px";b.style.top=fy+28+"px"
bulletContainer.appendChild(b)
const edx = ex - fx
const edy = ey - fy
const ed = Math.hypot(edx,edy)
if(ed>0){
bullets.push({dom:b,x:fx+30,y:fy+28,vx:edx/ed*5.5,vy:edy/ed*5.5})
}
}
//敌人被吞的时候,不追击
if(enemyTrapped){
requestAnimationFrame(loop)
return
}
//障碍碰撞(飞船副本)
if(!spaceMode){
obstacles.forEach(obs=>{
const dis = Math.hypot(px-obs.x, py-obs.y)
if(dis<42){playerHp-=6;updateHp();msgBox.innerText="💥撞到障碍! "}
})
//到达终点触发BOSS
if(!bossMode && px >= endX-100){
bossMode=true;enemy.innerText="☠️";enemyHp=140;updateHp()
progressTip.innerText="⚠️BOSS战开启!"
msgBox.innerText="抵达终点!骷髅BOSS出现!"
}
}
//敌人追击
const edx = px - ex; const edy = py -Game Source: 表情包大乱斗 - 新增🙃系统好友
Creator: UltraKoala46
Libraries: none
Complexity: complex (540 lines, 21.7 KB)
The full source code is displayed above on this page.
Remix Instructions
To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: game-ultrakoala46" to link back to the original. Then publish at arcadelab.ai/publish.