Meta Description" name="description" />
<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"><title>Free Fire Mobile</title><style>*{margin:0;padding:0;touch-action:none}body{background:#111;display:flex;align-items:center;justify-content:center;height:100vh;overflow:hidden}canvas{border:3px solid lime;border-radius:10px;background:#228B22;max-width:95vw;max-height:90vh}#ui{font:20px Arial;color:lime;position:absolute;top:10px;left:10px;right:10px;display:flex;justify-content:space-between}#joy{position:fixed;bottom:20px;left:20px;width:100px;height:100px;background:rgba(255,255,255,0.2);border:3px solid #fff;border-radius:50%}#knob{position:absolute;top:50%;left:50%;width:40px;height:40px;background:lime;border-radius:50%;transform:translate(-50%,-50%);transition:.1s}#fire{position:fixed;bottom:30px;right:30px;width:80px;height:80px;background:#f44;border:3px solid #fff;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:24px;color:#fff}</style></head><body><canvas id="c"></canvas><div id="ui"><span id="hp">HP:100</span><span id="sc">Score:0</span></div><div id="joy"><div id="knob"></div></div><div id="fire">π«</div><script>const c=document.getElementById`c`,ctx=c.getContext`2d`,s={p:{x:100,y:100,r:15,h:100,mh:100,a:0,sc:0},e:[],b:[],joy:{x:0,y:0},mx:0,my:0,t:0};c.width=innerWidth*.95;c.height=innerHeight*.75;const joy=document.getElementById`joy`,knob=document.getElementById`knob`,fire=document.getElementById`fire`;joy.ontouchstart=joy.ontouchmove=e=>{e.preventDefault();const r=joy.getBoundingClientRect(),cx=r.left+r.width/2,cy=r.top+r.height/2,t=e.touches[0],dx=t.clientX-cx,dy=t.clientY-cy,d=25,dist=Math.min(d,Math.hypot(dx,dy));s.joy.x=dist*Math.cos(Math.atan2(dy,dx))/d;s.joy.y=dist*Math.sin(Math.atan2(dy,dx))/d;knob.style.transform=`translate(${-50+s.joy.x*25}px,${-50+s.joy.y*25}px)`};joy.ontouchend=()=>{s.joy.x=s.joy.y=0;knob.style.transform='translate(-50%,-50%)'};fire.ontouchstart=()=>{const a=Math.atan2(s.my-s.p.y,s.mx-s.p.x);s.b.push({x:s.p.x,y:s.p.y,vx:Math.cos(a)*12,vy:Math.sin(a)*12})};c.ontouchmove=e=>{e.preventDefault();const t=e.touches[0],r=c.getBoundingClientRect();s.mx=t.clientX-r.left;s.my=t.clientY-r.top};function u(){s.p.x+=s.joy.x*5;s.p.y+=s.joy.y*5;s.p.x=Math.max(s.p.r,Math.min(c.width-s.p.r,s.p.x));s.p.y=Math.max(s.p.r,Math.min(c.height-s.p.r,s.p.y));s.p.a=Math.atan2(s.my-s.p.y,s.mx-s.p.x);s.e.forEach((e,i)=>{const dx=s.p.x-e.x,dy=s.p.y-e.y,d=Math.hypot(dx,dy);if(d<30){e.h-=1;s.p.h-=0.3}if(d>0){e.x+=(dx/d)*1.5;e.y+=(dy/d)*1.5;e.a=Math.atan2(dy,dx)}if(e.h<=0){s.p.sc+=100;for(let j=0;j<10;j++)s.particles.push({x:e.x,y:e.y,vx:(Math.random()-.5)*10,vy:(Math.random()-.5)*10,l:20,c:e.c});s.e.splice(i,1)}});s.b=s.b.filter(b=>{b.x+=b.vx;b.y+=b.vy;if(b.x<0||b.x>c.width||b.y<0||b.y>c.height)return 0;s.e.forEach((e,i)=>{if(Math.hypot(b.x-e.x,b.y-e.y)<15){e.h-=25;s.b.splice(s.b.indexOf(b),1);for(let j=0;j<5;j++)s.particles.push({x:b.x,y:b.y,vx:(Math.random()-.5)*8,vy:(Math.random()-.5)*8,l:15,c:'#ff0'})}});return 1});s.particles=s.particles.filter(p=>{p.x+=p.vx;p.y+=p.vy;p.vy+=.1;p.l--;return p.l>0});if(Math.random()<.02&&s.e.length<5)s.e.push({x:Math.random()*c.width,y:Math.random()*c.height,h:30,c:`hsl(${180+Math.random()*60},70%,50%)`});const szd=Math.hypot(s.p.x-c.width/2,s.p.y-c.height/2);if(szd>250)s.p.h-=.1;if(s.p.h<=0){alert(`Game Over! Score: ${s.p.sc}`);s.p.h=s.p.mh;s.p.sc=0;s.e=[]}}function d(){ctx.clearRect(0,0,c.width,c.height);ctx.strokeStyle='#0f0';ctx.lineWidth=3;ctx.beginPath();ctx.arc(c.width/2,c.height/2,250-s.t*0.1,0,Math.PI*2);ctx.stroke();ctx.save();ctx.translate(s.p.x,s.p.y);ctx.rotate(s.p.a);ctx.fillStyle='#0f0';ctx.shadowColor='#0f0';ctx.shadowBlur=15;ctx.fillRect(-s.p.r,-s.p.r,s.p.r*2,s.p.r*2);ctx.fillStyle='#222';ctx.fillRect(s.p.r-3,-3,15,6);ctx.restore();s.e.forEach(e=>{ctx.save();ctx.translate(e.x,e.y);ctx.rotate(e.a);ctx.fillStyle=e.c;ctx.shadowColor=e.c;ctx.shadowBlur=10;ctx.fillRect(-12,-12,24,24);ctx.fillStyle='#333';ctx.fillRect(10,-2,10,4);ctx.restore();const hp=e.h/30;ctx.fillStyle='rgba(255,0,0,0.6)';ctx.fillRect(e.x-12,e.y-20,24,3);ctx.fillStyle=`rgba(0,255,0,${hp})`;ctx.fillRect(e.x-12,e.y-20,24*hp,3)});s.b.forEach(b=>{ctx.fillStyle='#ff0';ctx.shadowColor='#ff0';ctx.shadowBlur=8;ctx.beginPath();ctx.arc(b.x,b.y,3,0,Math.PI*2);ctx.fill()});s.particles.forEach(p=>{ctx.save();ctx.globalAlpha=p.l/20;ctx.fillStyle=p.c;ctx.beginPath();ctx.arc(p.x,p.y,2,0,Math.PI*2);ctx.fill();ctx.restore()})}function loop(){s.t++;u();d();document.getElementById`hp`.textContent=`HP:${Math.max(0,Math.floor(s.p.h))}`;document.getElementById`sc`.textContent=`Score:${s.p.sc}`;requestAnimationFrame(loop)}loop();</script></body></html>1
1
5KB
5KB
97.0ms
116.0ms
98.0ms