Meta Description" name="description" />
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"><title>Battle Royale</title><style>*{box-sizing:border-box;user-select:none;-webkit-user-select:none}body{margin:0;background:#111;color:#fff;font-family:sans-serif;overflow:hidden;width:100vw;height:100vh;display:flex;flex-direction:column}#ui{background:rgba(0,0,0,0.8);padding:8px;display:flex;justify-content:space-around;font-size:14px;font-weight:bold;border-bottom:2px solid #333}#g{background:#2c3e50;width:100%;flex-grow:1}#ctrl{position:absolute;bottom:20px;left:0;right:0;display:flex;justify-content:space-between;padding:0 20px;pointer-events:none}.bt{width:100px;height:100px;background:rgba(255,255,255,0.15);border:3px solid rgba(255,255,255,0.4);border-radius:50%;display:flex;align-items:center;justify-content:center;pointer-events:auto}#stk{width:40px;height:40px;background:rgba(255,255,255,0.6);border-radius:50%}#f{background:rgba(231,76,60,0.6);color:#fff;font-weight:bold;font-size:18px}</style></head><body><div id="ui"><div>जीवित: <span id="a" style="color:#f1c40f">10</span></div><div>हेल्थ: <span id="h" style="color:#2ecc71">100</span></div><div>गन: <span id="w">पिस्तौल</span></div></div><canvas id="g"></canvas><div id="ctrl"><div id="jb" class="bt"><div id="stk"></div></div><div id="f" class="bt">FIRE</div></div><script>const canvas=document.getElementById("g"),ctx=canvas.getContext("2d");function res(){canvas.width=window.innerWidth;canvas.height=canvas.offsetHeight}let p=[],b=[],it=[],sr=300,sx,sy,mx=0,my=0,ja=false;const ply={x:100,y:200,s:14,c:"#3498db",sp:3,h:100,al:true,pl:true,an:0,g:false,ls:0};function init(){res();sx=canvas.width/2;sy=canvas.height/2;sr=Math.max(canvas.width,canvas.height)*0.6;p=[ply];b=[];it=[];for(let i=0;i<9;i++)p.push({x:Math.random()*(canvas.width-40)+20,y:Math.random()*(canvas.height-40)+20,s:14,c:"#e74c3c",sp:1.5,h:100,al:true,pl:false,an:Math.random()*Math.PI*2,g:Math.random()>0.5,ls:0,tx:Math.random()*canvas.width,ty:Math.random()*canvas.height});for(let i=0;i<5;i++){it.push({x:Math.random()*canvas.width,y:Math.random()*canvas.height,t:'r',c:'#f1c40f'});it.push({x:Math.random()*canvas.width,y:Math.random()*canvas.height,t:'m',c:'#2ecc71'})}}function dist(x1,y1,x2,y2){return Math.sqrt((x2-x1)**2+(y2-y1)**2)}function sht(s,a){const n=Date.now(),fr=s.g?250:600;if(n-s.ls<fr)return;s.ls=n;b.push({x:s.x,y:s.y,dx:Math.cos(a)*5,dy:Math.sin(a)*5,o:s,d:s.g?25:15})}const jb=document.getElementById("jb"),stk=document.getElementById("stk");jb.addEventListener("touchstart",e=>{ja=true;hj(e)},{passive:true});jb.addEventListener("touchmove",e=>{if(ja)hj(e)},{passive:true});jb.addEventListener("touchend",()=>{ja=false;mx=0;my=0;stk.style.transform="translate(0px,0px)"},{passive:true});function hj(e){const t=e.touches[0],r=jb.getBoundingClientRect(),cx=r.left+r.width/2,cy=r.top+r.height/2;let dx=t.clientX-cx,dy=t.clientY-cy,d=Math.sqrt(dx*dx+dy*dy),md=r.width/2;if(d>md){dx=(dx/d)*md;dy=(dy/d)*md}stk.style.transform=`translate(${dx}px,${dy}px)`;mx=dx/md;my=dy/md;if(ply.al&&(mx!==0||my!==0))ply.an=Math.atan2(my,mx)}document.getElementById("f").addEventListener("touchstart",()=>{if(ply.al)sht(ply,ply.an)},{passive:true});function loop(){ctx.clearRect(0,0,canvas.width,canvas.height);if(sr>40)sr-=0.08;ctx.beginPath();ctx.arc(sx,sy,sr,0,Math.PI*2);ctx.strokeStyle="#e67e22";ctx.lineWidth=3;ctx.stroke();it.forEach((item,idx)=>{ctx.fillStyle=item.c;ctx.beginPath();ctx.arc(item.x,item.y,6,0,Math.PI*2);ctx.fill();if(ply.al&&dist(ply.x,ply.y,item.x,item.y)<ply.s+6){if(item.t==='r'){ply.g=true;document.getElementById("w").innerText="AK-47"}else{ply.h=Math.min(100,ply.h+35)}it.splice(idx,1)}});p.forEach(p=>{if(!p.al)return;if(p.pl){p.x+=mx*p.sp;p.y+=my*p.sp}else{if(dist(p.x,p.y,p.tx,p.ty)<20){p.tx=Math.random()*canvas.width;p.ty=Math.random()*canvas.height}let at=Math.atan2(p.ty-p.y,p.tx-p.x);p.x+=Math.cos(at)*p.sp;p.y+=Math.sin(at)*p.sp;p.an=at;if(ply.al&&dist(p.x,p.y,ply.x,ply.y)<180){p.an=Math.atan2(ply.y-p.y,ply.x-p.x);sht(p,p.an)}}p.x=Math.max(p.s,Math.min(canvas.width-p.s,p.x));p.y=Math.max(p.s,Math.min(canvas.height-p.s,p.y));if(dist(p.x,p.y,sx,sy)>sr){p.h-=0.15;if(p.h<=0)p.al=false}ctx.save();ctx.translate(p.x,p.y);ctx.rotate(p.an);ctx.fillStyle=p.c;ctx.beginPath();ctx.arc(0,0,p.s,0,Math.PI*2);ctx.fill();ctx.fillStyle="#111";ctx.fillRect(0,-3,p.g?18:12,6);ctx.restore();ctx.fillStyle="red";ctx.fillRect(p.x-15,p.y-22,30,4);ctx.fillStyle="#2ecc71";ctx.fillRect(p.x-15,p.y-22,(p.h/100)*30,4)});b.forEach((bul,bIdx)=>{bul.x+=bul.dx;bul.y+=bul.dy;ctx.fillStyle="#f1c40f";ctx.beginPath();ctx.arc(bul.x,bul.y,3,0,Math.PI*2);ctx.fill();if(bul.x<0||bul.x>canvas.width||bul.y<0||bul.y>canvas.height){b.splice(bIdx,1);return}p.forEach(p=>{if(p.al&&bul.o!==p&&dist(bul.x,bul.y,p.x,p.y)<p.s){p.h-=bul.d;b.splice(bIdx,1);if(p.h<=0)p.al=false}})});let ap=p.filter(p=>p.al).length;document.getElementById("a").innerText=ap;document.getElementById("h").innerText=Math.max(0,Math.floor(ply.h));requestAnimationFrame(loop)}init();loop();window.addEventListener('resize',res);</script></body></html>
1
1
5KB
5KB
179.0ms
200.0ms
179.0ms