🎮ArcadeLab

LOOM GALAXY ATTACK

by MegaOtter89
184 lines9.7 KB
▶ Play
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LOOM GALAXY ATTACK</title>
<style>
*{box-sizing:border-box;font-family:Tahoma,Arial}
body{margin:0;background:#0a0a1f;color:#fff;text-align:center;overflow:hidden}
#logo{padding:10px 0 0}
#logo h1{margin:0;font-size:34px;color:#FFD700;text-shadow:0 0 15px #ff0000;line-height:1}
#logo h1 span{color:#fff}
#logo p{margin:0;color:#ff8c00;letter-spacing:8px;font-weight:bold}
#hud{display:flex;justify-content:space-around;background:#11113a;padding:8px;font-size:14px}
#hud b{color:#FFD700}
canvas{background:radial-gradient(#1a0a3a,#050514);display:block;margin:5px auto;border:2px solid #FFD700;border-radius:12px;touch-action:none;max-width:95vw}
button{background:#FFD700;color:#000;border:none;padding:10px 14px;border-radius:10px;font-weight:bold;margin:4px;cursor:pointer}
button:disabled{background:#555;color:#999}
#menu,#shipsDiv,#upgradeDiv,#mergeDiv{background:#14143d;margin:8px;padding:10px;border-radius:12px}
.shipBtn{width:30%;font-size:12px;padding:8px 4px}
.locked{opacity:.5}
</style>
</head>
<body>
<div id="logo"><h1>LOOM<br><span>GALAXY</span></h1><p>A T T A C K</p></div>
<div id="hud"><div>النقاط: <b id="score">0</b></div><div>الموجة: <b id="wave">1</b></div><div>العملات: 🪙 <b id="coins">0</b></div><div>الصحة: <b id="hp">100</b></div></div>
<canvas id="game" width="400" height="520"></canvas>
<div>
<button onclick="startGame()">▶ العب</button>
<button onclick="showDiv('shipsDiv')">🚀 السفن 20</button>
<button onclick="showDiv('upgradeDiv')">⬆️ ترقيات</button>
<button onclick="showDiv('mergeDiv')">🔥 دمج</button>
<button onclick="pauseGame()">⏸ إيقاف</button>
</div>

<div id="shipsDiv" style="display:none"><h3>🚀 20 سفينة جبارة</h3><div id="shipList"></div><p>اختر سفينة لتغيير لونك وقوتك</p></div>
<div id="upgradeDiv" style="display:none"><h3>⬆️ ترقيات قوية</h3>
<p>سلاح: مستوى <b id="wLv">1</b> - <button onclick="upgrade('weapon')">ترقية 50 🪙</button></p>
<p>درع: مستوى <b id="sLv">1</b> - <button onclick="upgrade('shield')">ترقية 50 🪙</button></p>
<p>سرعة: مستوى <b id="spLv">1</b> - <button onclick="upgrade('speed')">ترقية 50 🪙</button></p>
</div>
<div id="mergeDiv" style="display:none"><h3>🔥 نظام الدمج</h3><p>ادمج سفينتين لتفتح سفينة أقوى!</p><p>السفن المفتوحة: <b id="unlockedCount">1</b> / 20</p><button onclick="doMerge()">دمج سفينتين - 100 🪙</button><p id="mergeMsg"></p></div>

<script>
const canvas=document.getElementById('game'), ctx=canvas.getContext('2d');
let coins=parseInt(localStorage.getItem('loom_coins')||'200');
let high=parseInt(localStorage.getItem('loom_high')||'0');
let score=0, wave=1, running=false, paused=false;
let weaponLv=1, shieldLv=1, speedLv=1;

const ships=[
{name:"صقر النور",c:"#FFD700"},{name:"تنين النار",c:"#FF4500"},{name:"وحش الثلج",c:"#00BFFF"},
{name:"نجم النيون",c:"#FF00FF"},{name:"عملاق المجرة",c:"#8A2BE2"},{name:"برق الصحراء",c:"#FFFF00"},
{name:"حوت الفضاء",c:"#00CED1"},{name:"فراشة النور",c:"#7CFC00"},{name:"نسر الفجر",c:"#FF8C00"},
{name:"قمر الليل",c:"#C0C0C0"},{name:"شمس الصباح",c:"#FFD700"},{name:"جوهرة البحر",c:"#40E0D0"},
{name:"صاروخ البرق",c:"#00FFFF"},{name:"درع الجبل",c:"#808080"},{name:"زهرة النجوم",c:"#FF69B4"},
{name:"سيف الفضاء",c:"#FF0000"},{name:"قلب الكون",c:"#FF1493"},{name:"عاصفة الرمال",c:"#DEB887"},
{name:"نجم القطب",c:"#FFFFFF"},{name:"أسطورة لوم",c:"#000000"}
];
let unlocked=[0], curShip=0;
let player={x:200,y:460,w:36,h:40,hp:100,maxHp:100};
let bullets=[],enemies=[],parts=[],coinDrops=[],powers=[];
let enemyTimer=0, lastTime=0;

function save(){localStorage.setItem('loom_coins',coins);localStorage.setItem('loom_high',high);}
function updateHUD(){
document.getElementById('score').textContent=score;
document.getElementById('wave').textContent=wave;
document.getElementById('coins').textContent=coins;
document.getElementById('hp').textContent=player.hp;
document.getElementById('wLv').textContent=weaponLv;
document.getElementById('sLv').textContent=shieldLv;
document.getElementById('spLv').textContent=speedLv;
document.getElementById('unlockedCount').textContent=unlocked.length;
renderShips();
}
function showDiv(id){['shipsDiv','upgradeDiv','mergeDiv'].forEach(d=>document.getElementById(d).style.display=d===id?'block':'none');}
function renderShips(){
let h='';ships.forEach((s,i)=>{
let has=unlocked.includes(i);
h+=`<button class="shipBtn ${has?'':'locked'}" style="background:${s.c};color:${i===19?'#FFD700':'#000'}" onclick="selectShip(${i})">${has?'✅':'🔒'} ${s.name}</button>`;
});
document.getElementById('shipList').innerHTML=h;
}
function selectShip(i){if(!unlocked.includes(i)){alert('السفينة مقفلة! ادمج لتفتحها');return;}curShip=i;alert('اخترت: '+ships[i].name);updateHUD();}
function upgrade(type){
if(coins<50){alert('ما معك عملات كفاية! العب واجمع');return;}
coins-=50;
if(type==='weapon')weaponLv++;
if(type==='shield'){shieldLv++;player.maxHp+=20;player.hp=player.maxHp;}
if(type==='speed')speedLv++;
save();updateHUD();
}
function doMerge(){
if(coins<100){alert('بدك 100 عملة للدمج');return;}
if(unlocked.length>=20){alert('فتحت كل السفن! انت أسطورة');return;}
coins-=100;
let next=unlocked.length;
unlocked.push(next);
document.getElementById('mergeMsg').textContent='🔥 مبروك! فتحت سفينة جديدة: '+ships[next].name+' - لونها '+ships[next].c;
save();updateHUD();
}
function startGame(){score=0;wave=1;player.hp=player.maxHp;player.x=200;bullets=[];enemies=[];parts=[];coinDrops=[];running=true;paused=false;updateHUD();}
function pauseGame(){paused=!paused;}
function spawnEnemy(){
let types=[{c:'#FF0000',hp:2,s:1.2},{c:'#00FF00',hp:3,s:1},{c:'#FF00FF',hp:4,s:0.8},{c:'#00FFFF',hp:5,s:1.4},{c:'#FFFF00',hp:6,s:0.7}];
let t=types[Math.floor(Math.random()*types.length)];
let isBoss=wave%10===0 && Math.random()<0.2;
enemies.push({x:30+Math.random()*340,y:-30,w:isBoss?70:30,h:isBoss?70:30,hp:isBoss?30:t.hp+wave,c:t.c,s:t.s+wave*0.05,boss:isBoss});
if(Math.random()<0.1)powers.push({x:30+Math.random()*340,y:-20,type:'shield'});
}
function shoot(){
let n=weaponLv>=3?3:weaponLv>=2?2:1;
for(let i=0;i<n;i++)bullets.push({x:player.x+(i-(n-1)/2)*12,y:player.y-20,vy:-7});
}
canvas.addEventListener('pointermove',e=>{
let r=canvas.getBoundingClientRect();
player.x=(e.clientX-r.left)*(canvas.width/r.width);
player.y=(e.clientY-r.top)*(canvas.height/r.height);
if(player.y>480)player.y=480;
});
canvas.addEventListener('pointerdown',()=>{if(!running)startGame();});

let shootTimer=0;
function loop(t){
requestAnimationFrame(loop);
if(!running||paused){drawMenu();return;}
let dt=16;
shootTimer+=dt; if(shootTimer>220){shoot();shootTimer=0;}
enemyTimer+=dt; if(enemyTimer>700){spawnEnemy();enemyTimer=0; if(Math.random()<0.05)wave++;}
// تحديث
bullets.forEach(b=>b.y+=b.vy); bullets=bullets.filter(b=>b.y>-10);
enemies.forEach(e=>{e.y+=e.s; if(Math.random()<0.01)e.x+= (Math.random()-0.5)*20;});
enemies=enemies.filter(e=>e.y<560);
parts.forEach(p=>{p.x+=p.vx;p.y+=p.vy;p.life--;}); parts=parts.filter(p=>p.life>0);
coinDrops.forEach(c=>c.y+=2); coinDrops=coinDrops.filter(c=>c.y<560);
// تصادم
bullets.forEach((b,bi)=>{enemies.forEach((e,ei)=>{
if(b.x>e.x-e.w/2&&b.x<e.x+e.w/2&&b.y>e.y-e.h/2&&b.y<e.y+e.h/2){
e.hp-=1+weaponLv*0.5; bullets.splice(bi,1);
if(e.hp<=0){score+=e.boss?500:50; coins+=e.boss?50:5;
for(let i=0;i<12;i++)parts.push({x:e.x,y:e.y,vx:(Math.random()-0.5)*4,vy:(Math.random()-0.5)*4,life:20,c:e.c});
coinDrops.push({x:e.x,y:e.y}); enemies.splice(ei,1);
if(score>high){high=score;save();}
}
}});});
enemies.forEach((e,ei)=>{
if(Math.abs(e.x-player.x)<30&&Math.abs(e.y-player.y)<30){player.hp-=10;enemies.splice(ei,1); if(player.hp<=0){running=false;alert('انتهت اللعبة! نقاطك: '+score+' - أعلى نتيجة: '+high+' - العملات: '+coins);}}
});
coinDrops.forEach((c,ci)=>{if(Math.abs(c.x-player.x)<25&&Math.abs(c.y-player.y)<25){coins+=5;coinDrops.splice(ci,1);save();}});
updateHUD(); draw();
}
function drawMenu(){
ctx.fillStyle='#050514';ctx.fillRect(0,0,400,520);
ctx.fillStyle='#FFD700';ctx.font='bold 26px Tahoma';ctx.textAlign='center';
ctx.fillText('LOOM GALAXY',200,200);ctx.fillStyle='#fff';ctx.fillText('ATTACK',200,240);
ctx.fillStyle='#FF8C00';ctx.font='16px Tahoma';ctx.fillText('اكبس العب لتبدأ',200,300);
ctx.fillText('اسحب إصبعك لتحرك السفينة',200,330);
}
function draw(){
ctx.fillStyle='#0a0a2a';ctx.fillRect(0,0,400,520);
// نجوم
for(let i=0;i<50;i++){ctx.fillStyle='#fff';ctx.fillRect((i*73)%400,(i*47+Date.now()/20)%520,2,2);}
// لاعب
ctx.fillStyle=ships[curShip].c;
ctx.beginPath();ctx.moveTo(player.x,player.y-20);ctx.lineTo(player.x-18,player.y+20);ctx.lineTo(player.x+18,player.y+20);ctx.closePath();ctx.fill();
ctx.fillStyle='#fff';ctx.fillRect(player.x-3,player.y-5,6,15);
// رصاص
ctx.fillStyle='#FFFF00';bullets.forEach(b=>ctx.fillRect(b.x-2,b.y,4,12));
// أعداء
enemies.forEach(e=>{
ctx.fillStyle=e.c;ctx.fillRect(e.x-e.w/2,e.y-e.h/2,e.w,e.h);
ctx.fillStyle='#fff';ctx.font='10px Tahoma';ctx.fillText(e.boss?'BOSS':'👾',e.x-10,e.y+5);
});
// عملات
ctx.fillStyle='#FFD700';coinDrops.forEach(c=>{ctx.beginPath();ctx.arc(c.x,c.y,7,0,Math.PI*2);ctx.fill();});
// جزيئات
parts.forEach(p=>{ctx.fillStyle=p.c;ctx.fillRect(p.x,p.y,4,4);});
}
updateHUD(); drawMenu();
requestAnimationFrame(loop);
</script>
</body>
</html>

Game Source: LOOM GALAXY ATTACK

Creator: MegaOtter89

Libraries: none

Complexity: moderate (184 lines, 9.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: loom-galaxy-attack-megaotter89" to link back to the original. Then publish at arcadelab.ai/publish.