Meta Description" name="description" />
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<style>
body{margin:0;background:#0f1930;color:#fff;font-family:Arial;text-align:center;overflow:hidden}
#game{position:relative;width:360px;height:640px;margin:0 auto;background:linear-gradient(#6bbd4a,#3a7a2b);border:3px solid #fff;border-radius:16px;overflow:hidden}
.torre{position:absolute;width:60px;height:60px;background:#888;border:2px solid #fff;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:22px}
#ui{width:360px;margin:6px auto} .barra{height:18px;background:#333;border-radius:10px;overflow:hidden} #fill{height:100%;background:#d946ef;width:50%}
.cartas{display:flex;gap:6px;justify-content:center;margin-top:6px} .carta{width:82px;height:100px;background:#1e2a5a;border:2px solid #fff;border-radius:10px;font-size:12px;padding:4px}
.carta b{font-size:20px}
</style></head><body>
<h3 style="margin:4px">TOWER RUSH - Tu Royale</h3>
<div id="game">
<div class="torre" style="left:40px;top:20px" id="et1">π°<br><span>1800</span></div>
<div class="torre" style="left:150px;top:10px" id="ek">π<br><span>2500</span></div>
<div class="torre" style="left:260px;top:20px" id="et2">π°<br><span>1800</span></div>
<div style="position:absolute;top:280px;width:100%;height:12px;background:#4a8bd4">RΓO</div>
<div class="torre" style="left:40px;top:560px" id="mt1">π°<br><span>1800</span></div>
<div class="torre" style="left:150px;top:570px" id="mk">π<br><span>2500</span></div>
<div class="torre" style="left:260px;top:560px" id="mt2">π°<br><span>1800</span></div>
<canvas id="cv" width="360" height="640" style="position:absolute;left:0;top:0"></canvas>
</div>
<div id="ui">
<div>Elixir: <span id="el">5</span>/10</div>
<div class="barra"><div id="fill"></div></div>
<div class="cartas">
<div class="carta" onclick="spawn(0)"><b>βοΈ</b><br>Caballero<br>3 elixir</div>
<div class="carta" onclick="spawn(1)"><b>πΉ</b><br>Arqueras<br>3 elixir</div>
<div class="carta" onclick="spawn(2)"><b>πΏ</b><br>Gigante<br>5 elixir</div>
<div class="carta" onclick="spawn(3)"><b>π₯</b><br>Bola Fuego<br>4 elixir</div>
</div>
</div>
<script>
let elixir=5, cv=document.getElementById('cv'), ctx=cv.getContext('2d'), tropas=[], ehp={et1:1800,et2:1800,ek:2500,mt1:1800,mt2:1800,mk:2500};
setInterval(()=>{if(elixir<10){elixir++; document.getElementById('el').innerText=elixir; document.getElementById('fill').style.width=elixir*10+'%'}},850);
function spawn(t){
let cost=[3,3,5,4][t]; if(elixir<cost) return; elixir-=cost;
if(t==3){ // hechizo directo
ehp.et1-=300; ehp.et2-=300; tropas=tropas.filter(x=>x.b!=1||(Math.random()>0.5));
} else {
tropas.push({x:180+ (Math.random()*80-40), y:500, b:0, t:t, hp:[150,90,400][t], s:[1.8,1.5,0.8][t]});
}
}
setInterval(()=>{ if(Math.random()<0.7) { let t=Math.floor(Math.random()*3); tropas.push({x:180+ (Math.random()*80-40), y:80, b:1, t:t, hp:[150,90,400][t], s:[1.8,1.5,0.8][t]}) } },1900);
function loop(){
ctx.clearRect(0,0,360,640);
tropas.forEach((p,i)=>{
p.y+=p.b==0?-p.s:p.s;
ctx.fillStyle=p.b==0?'#ffeb00':'#ff4444'; ctx.beginPath(); ctx.arc(p.x,p.y, p.t==2?14:9,0,6.28); ctx.fill();
// colision torre
if(p.b==0 && p.y<90){ if(ehp.et1>0) ehp.et1-=5; else if(ehp.ek>0) ehp.ek-=5; }
if(p.b==1 && p.y>550){ if(ehp.mt1>0) ehp.mt1-=5; else if(ehp.mk>0) ehp.mk-=5; }
});
for(let k in ehp){ let e=document.getElementById(k); if(e) e.innerHTML=(k.includes('k')?'π':'π°')+'<br><span>'+Math.max(0,ehp[k])+'</span>'; if(ehp[k]<=0 && e) e.style.opacity=.2 }
if(ehp.ek<=0){ alert('Β‘GANASTE LA PARTIDA!'); location.reload() }
if(ehp.mk<=0){ alert('Perdiste, dale otra vez'); location.reload() }
requestAnimationFrame(loop)
} loop();
</script></body></html>1
1
4KB
4KB
390.0ms
500.0ms
390.0ms