Meta Description" name="description" />
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>ALTAMASH - OFFLINE SIMULATOR</title>
<link rel="manifest" href="data:application/json;base64,eyJuYW1lIjoiQUxUQU1BU0ggT0ZGTElORSIsInNob3J0X25hbWUiOiJBTExUQU1BU0giLCJzdGFydF91cmwiOiIuIiwiZGlzcGxheSI6InN0YW5kYWxvbmUiLCJiYWNrZ3JvdW5kX2NvbG9yIjoiIzBhMGEwYSIsInRoZW1lX2NvbG9yIjoiIzAwZmZmZiJ9">
<style>
body{margin:0; overflow:hidden; background:#0a0a0a; font-family:Arial;}
canvas{display:block;}
#ui{position:absolute; top:8px; left:8px; color:#00ffff; background:rgba(0,0,0,0.7); padding:8px 12px; border-radius:10px; z-index:10; font-size:13px; line-height:18px;}
#controls{position:absolute; bottom:12px; width:100%; display:flex; justify-content:space-between; padding:0 12px; box-sizing:border-box; z-index:10;}
.btn{width:85px; height:85px; background:rgba(0,255,255,0.2); border:2px solid #00ffff; border-radius:50%; color:#fff; font-size:12px; font-weight:bold; display:flex; align-items:center; justify-content:center; user-select:none;}
.btn:active{background:rgba(0,255,255,0.6);}
#startScreen{position:absolute; inset:0; background:rgba(0,0,0,0.95); display:flex; flex-direction:column; align-items:center; justify-content:center; z-index:20; color:#fff; text-align:center;}
.car-select{display:flex; gap:10px; margin:12px 0;}
.car-option{width:80px; height:105px; border:2px solid #333; border-radius:10px; display:flex; flex-direction:column; align-items:center; justify-content:center; cursor:pointer; background:#111;}
.car-option.selected{border-color:#00ffff; box-shadow:0 0 12px #00ffff;}
.car-mini{width:34px; height:50px; border-radius:5px; margin-bottom:6px;}
button.play{padding:12px 40px; background:#00ffff; border:none; border-radius:30px; font-weight:bold; font-size:18px; margin-top:10px; box-shadow:0 0 15px #00ffff;}
</style>
</head>
<body>
<div id="ui">CITY: <span id="city">DELHI - NH44</span><br>DIST: <span id="score">0</span>m | FUEL: <span id="fuel">100</span>%<br>PASSENGER: <span id="pass">0/3</span> | ₹<span id="money">0</span><br><small style="color:lime;">● OFFLINE MODE</small></div>
<div id="startScreen">
<h1 style="letter-spacing:7px; text-shadow:0 0 15px #00ffff; margin:0;">ALTAMASH</h1>
<p style="color:#00ffff; margin:4px;">OFFLINE - NO INTERNET NEEDED</p>
<div class="car-select">
<div class="car-option selected" onclick="selectCar(0)" id="opt0"><div class="car-mini" style="background:#00ffff;"></div><span>CYAN</span><small style="color:lime;">FREE</small></div>
<div class="car-option" onclick="selectCar(1)" id="opt1"><div class="car-mini" style="background:#ff0040;"></div><span>RED</span><small style="color:lime;">FREE</small></div>
<div class="car-option" onclick="selectCar(2)" id="opt2"><div class="car-mini" style="background:#ffea00;"></div><span>YELLOW</span><small style="color:lime;">FREE</small></div>
</div>
<button class="play" onclick="startGame()">PLAY OFFLINE</button>
<p style="font-size:10px; opacity:0.6; margin-top:15px;">Ek baar Add to Home Screen karne ke baad<br>bina internet ke chalega</p>
</div>
<div id="controls"><div class="btn" id="leftBtn">BRAKE</div><div class="btn" id="rightBtn">RACE / PICK</div></div>
<canvas id="c"></canvas>
<script>
// OFFLINE SERVICE WORKER - isse game offline banega
if('serviceWorker' in navigator){
navigator.serviceWorker.register(URL.createObjectURL(new Blob([`self.addEventListener('install',e=>{e.waitUntil(caches.open('altamash-v1').then(c=>c.addAll(['./'])))}); self.addEventListener('fetch',e=>{e.respondWith(caches.match(e.request).then(r=>r||fetch(e.request)))})`],{type:'text/javascript'})));
}
let canvas=document.getElementById('c'), ctx=canvas.getContext('2d');
canvas.width=window.innerWidth; canvas.height=window.innerHeight;
let cars=[{name:'CYAN',color:'#00ffff'},{name:'RED',color:'#ff0040'},{name:'YELLOW',color:'#ffea00'}];
let sel=0; function selectCar(i){ sel=i; document.querySelectorAll('.car-option').forEach(e=>e.classList.remove('selected')); document.getElementById('opt'+i).classList.add('selected'); }
let gameRunning=false, score=0, fuel=100, money=0, passCount=0;
let car={x:150,y:0,w:60,h:32,speed:0,vy:0,angle:0};
let hills=[], offset=0, keys={}, leftP=false,rightP=false;
let cityData=[{name:'DELHI',dist:0,road:'NH-44'},{name:'MUMBAI',dist:500,road:'NH-48'},{name:'FOREST',dist:900,road:'FOREST',isForest:true},{name:'GOA',dist:1400,road:'NH-66'},{name:'HYDERABAD',dist:1900,road:'NH-65'},{name:'SARI',dist:2400,road:'NH-19'}];
let busStops=[];
function genHills(){
hills=[]; let y=canvas.height-150;
for(let x=0;x<8000;x+=30){ y+=(Math.random()-0.5)*35; if(y>canvas.height-80) y=canvas.height-80; if(y<canvas.height-320) y=canvas.height-320; hills.push({x,y}); }
busStops=[]; cityData.forEach(c=>{ if(!c.isForest) busStops.push({worldX:c.dist*2, y:getY(c.dist*2), city:c.name, waiting:1}); });
}
function getY(wx){ let idx=Math.floor(wx/30); if(idx<0) idx=0; if(idx>=hills.length-1) idx=hills.length-2; let h1=hills[idx],h2=hills[idx+1]; let t=(wx-h1.x)/30; return h1.y*(1-t)+h2.y*t; }
function getAng(wx){ return Math.atan2(getY(wx+10)-getY(wx-10),20); }
function startGame(){ genHills(); document.getElementById('startScreen').style.display='none'; gameRunning=true; score=0; fuel=100; money=0; passCount=0; offset=0; car.speed=0; animate(); }
function animate(){
if(!gameRunning) return;
ctx.fillStyle='#0a0a0a'; ctx.fillRect(0,0,canvas.width,canvas.height);
if(rightP||keys['ArrowRight']||keys['d']){ car.speed+=0.16; fuel-=0.06; }
if(leftP||keys['ArrowLeft']||keys['a']){ car.speed-=0.13; }
car.speed*=0.984; if(car.speed>8) car.speed=8; if(car.speed<-3) car.speed=-3; offset+=car.speed; score=Math.floor(offset/10);
let cur=cityData[0]; for(let c of cityData){ if(score>=c.dist) cur=c; }
document.getElementById('city').innerText=cur.name+' - '+cur.road;
if(cur.isForest) car.speed*=0.92;
fuel-=Math.abs(car.speed)*0.012; if(fuel<=0){ gameOver(); return; }
let gy=getY(offset+car.x+car.w/2); car.vy+=(gy-car.h-12-car.y)*0.15; car.vy*=0.7; car.y+=car.vy; car.angle=getAng(offset+car.x+car.w/2)+car.speed*0.02;
ctx.beginPath(); ctx.moveTo(0,canvas.height); for(let sx=0;sx<=canvas.width;sx+=10){ ctx.lineTo(sx,getY(offset+sx)); } ctx.lineTo(canvas.width,canvas.height); ctx.closePath(); ctx.fillStyle=cur.isForest?'#102010':'#1a1a1a'; ctx.fill(); ctx.strokeStyle=cur.isForest?'#0f0':'#00ffff'; ctx.lineWidth=4; ctx.stroke();
busStops.forEach(bs=>{
let sx=bs.worldX-offset; if(sx>-80&&sx<canvas.width+80){
let y=bs.y; ctx.fillStyle='#fff'; ctx.fillRect(sx-2,y-45,4,35); ctx.fillStyle='#00ff88'; ctx.fillRect(sx-20,y-55,40,12); ctx.fillStyle='#000'; ctx.font='7px Arial'; ctx.textAlign='center'; ctx.fillText('STOP',sx,y-47);
if(bs.waiting>0){ ctx.fillStyle='#ff0'; ctx.beginPath(); ctx.arc(sx+12,y-8,5,0,Math.PI*2); ctx.fill(); }
if(Math.abs(car.x1
1
7KB
7KB
89.0ms
192.0ms
90.0ms