🎮ArcadeLab

الصاروخ المتنكر - النسخة الأسطورية

by ChromeFlame24
335 lines19.9 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, user-scalable=no, maximum-scale=1.0">
<title>الصاروخ المتنكر - النسخة الأسطورية</title>
<style>
  * { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; user-select:none; -webkit-user-select:none; touch-action:none; }
  html, body { width:100%; height:100%; overflow:hidden; background:#000; font-family: 'Segoe UI', Tahoma, sans-serif; }
  canvas { display:block; position:fixed; inset:0; width:100%; height:100%; }
  .overlay { position:fixed; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; pointer-events:none; }
  .overlay > * { pointer-events:auto; }
  .hidden { display:none !important; }
  
  #ageBadge { position:fixed; top:12px; left:12px; background:linear-gradient(135deg, rgba(0,0,0,0.9), rgba(20,30,50,0.9)); color:#ffd700; padding:9px 18px; border-radius:30px; font-size:14px; font-weight:bold; border:2px solid #ffd700; z-index:100; box-shadow: 0 0 30px rgba(255,215,0,0.6), inset 0 0 15px rgba(255,215,0,0.2); backdrop-filter: blur(10px); }
  #coinsDisplay { position:fixed; top:12px; right:12px; background:linear-gradient(135deg, rgba(0,0,0,0.9), rgba(20,30,50,0.9)); color:#ffd700; padding:9px 18px; border-radius:30px; font-weight:bold; border:2px solid #ffd700; z-index:100; font-size:15px; box-shadow: 0 0 30px rgba(255,215,0,0.6), inset 0 0 15px rgba(255,215,0,0.2); backdrop-filter: blur(10px); }
  
  /* Main Menu */
  #mainMenu { background: radial-gradient(ellipse at center, #1a2a4a 0%, #050a15 100%); z-index:50; }
  .menuBgCanvas { position:absolute; inset:0; z-index:-1; opacity:0.4; }
  .title { font-size: clamp(44px, 10vw, 90px); color:#ffd700; text-shadow: 0 0 60px #ff8c00, 0 0 120px #ff6a00, 0 6px 25px rgba(0,0,0,0.95); font-weight:900; letter-spacing:4px; margin-bottom:15px; text-align:center; animation: titleGlow 2.5s ease-in-out infinite; }
  @keyframes titleGlow { 0%,100% { text-shadow: 0 0 60px #ff8c00, 0 0 120px #ff6a00, 0 6px 25px rgba(0,0,0,0.95); filter: brightness(1); } 50% { text-shadow: 0 0 80px #ffaa00, 0 0 150px #ff8c00, 0 6px 25px rgba(0,0,0,0.95); filter: brightness(1.2); } }
  .subtitle { color:#b0c4de; font-size: clamp(16px, 3.5vw, 24px); margin-bottom:55px; text-align:center; text-shadow: 0 2px 15px rgba(0,0,0,0.95); letter-spacing:1px; }
  .menuBtn { background: linear-gradient(180deg, #2a3a5a 0%, #1a2a4a 50%, #0a1a3a 100%); color:#ffd700; border:3px solid #ffd700; padding:22px 80px; font-size:26px; font-weight:bold; border-radius:18px; margin:12px; cursor:pointer; min-width:300px; transition:all 0.3s; box-shadow: 0 10px 40px rgba(255,215,0,0.5), inset 0 2px 10px rgba(255,255,255,0.1); position:relative; overflow:hidden; letter-spacing:1px; }
  .menuBtn::before { content:''; position:absolute; top:-50%; left:-50%; width:200%; height:200%; background: linear-gradient(45deg, transparent, rgba(255,215,0,0.4), transparent); transform: rotate(45deg); transition:all 0.6s; }
  .menuBtn:hover::before { left:100%; }
  .menuBtn:active { transform:scale(0.95); box-shadow: 0 5px 25px rgba(255,215,0,0.8); }
  .menuBtn.small { padding:16px 45px; font-size:20px; min-width:220px; }
  
  /* HUD */
  #hud { position:fixed; inset:0; pointer-events:none; z-index:20; }
  #hud > * { pointer-events:auto; }
  .hudTop { position:absolute; top:14px; left:14px; right:14px; display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
  .hudPanel { background:linear-gradient(180deg, rgba(0,0,0,0.85), rgba(10,20,40,0.85)); color:#ffd700; padding:12px 22px; border-radius:14px; font-size:16px; font-weight:bold; border:2px solid rgba(255,215,0,0.6); backdrop-filter: blur(10px); box-shadow: 0 6px 30px rgba(0,0,0,0.7), inset 0 1px 5px rgba(255,255,255,0.1); }
  .exitBtn { background: linear-gradient(180deg, #dc143c 0%, #8b0000 100%); color:#fff; border:3px solid #fff; padding:14px 26px; border-radius:14px; font-size:20px; font-weight:900; cursor:pointer; box-shadow: 0 6px 30px rgba(220,20,60,0.7), inset 0 2px 8px rgba(255,255,255,0.2); }
  .hudBottom { position:absolute; bottom:30px; left:0; right:0; display:flex; justify-content:space-between; padding:0 30px; }
  .actionBtn { width:115px; height:115px; border-radius:50%; border:5px solid #ffd700; font-size:20px; font-weight:900; color:#fff; cursor:pointer; box-shadow: 0 10px 40px rgba(0,0,0,0.8), inset 0 3px 15px rgba(255,255,255,0.2); transition:all 0.2s; text-shadow: 0 2px 5px rgba(0,0,0,0.8); }
  .actionBtn:active { transform:scale(0.88); }
  .boostBtn { background: radial-gradient(circle at 30% 30%, #ff8c00 0%, #ff6a00 40%, #c13a00 100%); }
  .brakeBtn { background: radial-gradient(circle at 30% 30%, #6ab0ff 0%, #4a90e2 40%, #1a4a8a 100%); }
  .shootBtn { background: radial-gradient(circle at 30% 30%, #ff6a6a 0%, #e24a4a 40%, #8b0000 100%); position:absolute; bottom:170px; right:30px; width:100px; height:100px; border-radius:50%; border:5px solid #ffd700; color:#fff; font-weight:900; font-size:20px; cursor:pointer; box-shadow: 0 10px 40px rgba(226,74,74,0.8), inset 0 3px 15px rgba(255,255,255,0.2); }
  .muteBtn { position:absolute; top:14px; left:50%; transform:translateX(-50%); background:linear-gradient(180deg, rgba(0,0,0,0.85), rgba(10,20,40,0.85)); color:#ffd700; border:2px solid #ffd700; padding:12px 22px; border-radius:28px; font-size:18px; cursor:pointer; backdrop-filter: blur(10px); box-shadow: 0 4px 20px rgba(0,0,0,0.6); }
  
  /* Mission Card */
  #missionCard { background: radial-gradient(ellipse at center, rgba(20,30,50,0.98) 0%, rgba(5,10,20,0.995) 100%); z-index:40; padding:25px; }
  .cardBox { background: linear-gradient(180deg, #1a2a4a 0%, #0a1a2a 100%); border:3px solid #ffd700; border-radius:24px; padding:35px; max-width:600px; width:93%; box-shadow: 0 25px 80px rgba(255,215,0,0.5), inset 0 2px 15px rgba(255,255,255,0.1); }
  .cardTitle { color:#ffd700; font-size:32px; font-weight:900; text-align:center; margin-bottom:22px; text-shadow: 0 0 30px rgba(255,215,0,0.7); letter-spacing:1px; }
  .cardBody { color:#e0e8f0; font-size:18px; line-height:2.2; margin-bottom:22px; }
  .cardWarn { color:#ff6a6a; font-size:16px; line-height:2; padding:15px; background:rgba(200,30,30,0.25); border-radius:13px; border-right:5px solid #ff6a6a; box-shadow: inset 0 0 20px rgba(255,0,0,0.1); }
  
  /* Alert */
  #alertOverlay { position:fixed; inset:0; background:rgba(200,30,30,0.5); z-index:30; display:flex; align-items:center; justify-content:center; pointer-events:none; animation: alertPulse 0.35s infinite alternate; }
  @keyframes alertPulse { from { background:rgba(200,30,30,0.35);} to { background:rgba(200,30,30,0.7);} }
  .alertText { color:#fff; font-size:clamp(38px, 8vw, 65px); font-weight:900; text-shadow: 0 0 40px #ff0000, 0 0 80px #ff0000, 0 0 120px #ff0000; animation: alertShake 0.06s infinite alternate; letter-spacing:2px; }
  @keyframes alertShake { from { transform:translate(-5px,-5px) rotate(-1deg);} to { transform:translate(5px,5px) rotate(1deg);} }
  
  /* Shop */
  #shopScreen { background: radial-gradient(ellipse at center, #1a2a4a 0%, #050a15 100%); z-index:50; overflow-y:auto; padding:30px; }
  .shopTitle { color:#ffd700; font-size:40px; font-weight:900; margin-bottom:20px; text-shadow: 0 0 35px rgba(255,215,0,0.7); letter-spacing:2px; }
  .shopTabs { display:flex; gap:15px; margin-bottom:30px; flex-wrap:wrap; justify-content:center; }
  .shopTab { background:rgba(255,215,0,0.2); color:#ffd700; border:2px solid #ffd700; padding:13px 28px; border-radius:30px; cursor:pointer; font-weight:bold; transition:all 0.3s; font-size:15px; }
  .shopTab.active { background:#ffd700; color:#000; box-shadow: 0 0 30px rgba(255,215,0,0.8); }
  .rocketsGrid { display:grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap:18px; max-width:1400px; width:100%; }
  .rocketCard { background: linear-gradient(180deg, #1a2a4a 0%, #0a1a2a 100%); border:3px solid #4a5a7a; border-radius:18px; padding:18px; cursor:pointer; transition:all 0.3s; position:relative; }
  .rocketCard:hover { transform:translateY(-7px); box-shadow: 0 12px 40px rgba(255,215,0,0.5); }
  .rocketCard.owned { border-color:#4a8a4a; }
  .rocketCard.equipped { border-color:#ffd700; box-shadow: 0 0 40px rgba(255,215,0,0.9); }
  .rocketPreview { width:100%; height:135px; background: radial-gradient(ellipse at center, #2a3a5a 0%, #0a1a2a 100%); border-radius:13px; margin-bottom:12px; }
  .rocketName { color:#ffd700; font-size:16px; font-weight:bold; text-align:center; margin-bottom:10px; }
  .rocketStats { display:grid; grid-template-columns: 1fr 1fr; gap:7px; font-size:13px; color:#b0c4de; }
  .statBar { background:rgba(255,255,255,0.2); height:10px; border-radius:5px; overflow:hidden; margin-top:4px; }
  .statFill { height:100%; background: linear-gradient(90deg, #ffd700, #ff8c00); box-shadow: 0 0 15px rgba(255,215,0,0.8); }
  .rocketPrice { color:#ffd700; font-size:14px; font-weight:bold; text-align:center; margin-top:9px; padding:7px; background:rgba(255,215,0,0.18); border-radius:9px; }
  .rocketPrice.owned { color:#4a8a4a; background:rgba(74,138,74,0.22); }
  
  /* Builder */
  #builderScreen { background: radial-gradient(ellipse at center, #1a2a4a 0%, #050a15 100%); z-index:50; padding:25px; overflow-y:auto; }
  .builderBox { max-width:780px; width:100%; }
  .builderPreview { width:100%; height:250px; background: radial-gradient(ellipse at center, #2a3a5a 0%, #0a1a2a 100%); border-radius:15px; margin-bottom:22px; border:3px solid #ffd700; box-shadow: 0 0 35px rgba(255,215,0,0.5); }
  .builderControls { display:grid; grid-template-columns: 1fr 1fr; gap:15px; }
  .controlGroup { background:rgba(0,0,0,0.55); padding:15px; border-radius:13px; border:2px solid rgba(255,215,0,0.45); }
  .controlLabel { color:#ffd700; font-size:15px; font-weight:bold; margin-bottom:11px; }
  .colorPicker { display:flex; gap:8px; flex-wrap:wrap; }
  .colorSwatch { width:36px; height:36px; border-radius:50%; cursor:pointer; border:3px solid transparent; transition:all 0.2s; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
  .colorSwatch.selected { border-color:#fff; transform:scale(1.25); box-shadow: 0 0 20px rgba(255,255,255,0.7); }
  .shapePicker { display:flex; gap:8px; flex-wrap:wrap; }
  .shapeBtn { padding:9px 15px; background:rgba(255,215,0,0.18); color:#ffd700; border:2px solid #ffd700; border-radius:9px; cursor:pointer; font-size:14px; transition:all 0.2s; }
  .shapeBtn.selected { background:#ffd700; color:#000; box-shadow: 0 0 18px rgba(255,215,0,0.7); }
  .nameInput { width:100%; padding:13px; background:rgba(0,0,0,0.65); color:#ffd700; border:2px solid #ffd700; border-radius:11px; font-size:18px; text-align:center; }
  
  /* Result */
  #resultScreen { background: rgba(0,0,0,0.92); z-index:45; }
  .resultBox { background: linear-gradient(180deg, #1a2a4a 0%, #0a1a2a 100%); border:3px solid #ffd700; border-radius:20px; padding:38px; max-width:450px; text-align:center; box-shadow: 0 20px 60px rgba(255,215,0,0.6); }
  .resultTitle { font-size:42px; font-weight:900; margin-bottom:20px; letter-spacing:2px; }
  .resultTitle.win { color:#ffd700; text-shadow: 0 0 30px #ff8c00; }
  .resultTitle.lose { color:#ff4a4a; text-shadow: 0 0 30px #ff0000; }
  .resultReward { color:#ffd700; font-size:26px; margin:20px 0; }
  
  @media (max-width: 600px) {
    .actionBtn { width:90px; height:90px; font-size:16px; }
    .shootBtn { width:80px; height:80px; bottom:135px; font-size:15px; }
    .menuBtn { padding:18px 50px; font-size:20px; min-width:240px; }
    .hudPanel { font-size:14px; padding:10px 16px; }
  }
</style>
</head>
<body>

<div id="ageBadge">+12 مناسب لعمر 12 وما فوق</div>
<div id="coinsDisplay">💰 0</div>

<canvas id="canvas"></canvas>

<div class="overlay" id="mainMenu">
  <canvas class="menuBgCanvas" id="menuBg"></canvas>
  <div class="title">🚀 الصاروخ المتنكر</div>
  <div class="subtitle">نفّذ المهمة.. انفجر البيت.. اهرب قبل ما يمسكوك</div>
  <button class="menuBtn" onclick="startGame()">🎮 العب</button>
  <button class="menuBtn" onclick="openShop()">🛒 المتجر</button>
  <button class="menuBtn small" onclick="openBuilder()">🔧 اصنع صاروخك</button>
</div>

<div class="overlay hidden" id="missionCard">
  <div class="cardBox">
    <div class="cardTitle" id="missionTitle">المهمة</div>
    <div class="cardBody" id="missionBody"></div>
    <div class="cardWarn" id="missionWarn"></div>
    <button class="menuBtn" style="margin-top:22px; width:100%;" onclick="beginMission()">ابدأ المهمة</button>
  </div>
</div>

<div id="hud" class="hidden">
  <div class="hudTop">
    <div class="hudPanel" id="hudTarget">🎯 الهدف: -</div>
    <button class="muteBtn" id="muteBtn" onclick="toggleMute()">🔊</button>
    <button class="exitBtn" onclick="exitToMenu()">✕ خروج</button>
  </div>
  <div class="hudBottom">
    <button class="actionBtn brakeBtn" id="brakeBtn">فرامل</button>
    <button class="actionBtn boostBtn" id="boostBtn">BOOST</button>
  </div>
  <button class="shootBtn hidden" id="shootBtn">🔥 نار</button>
</div>

<div id="alertOverlay" class="hidden">
  <div class="alertText">⚠ انكشف! اهرب!</div>
</div>

<div class="overlay hidden" id="shopScreen">
  <div class="shopTitle">🛒 المتجر</div>
  <div class="shopTabs">
    <div class="shopTab active" onclick="switchShopTab('ready', this)">جاهز</div>
    <div class="shopTab" onclick="switchShopTab('custom', this)">صاروخي</div>
  </div>
  <div class="rocketsGrid" id="rocketsGrid"></div>
  <button class="menuBtn small" style="margin-top:25px;" onclick="closeShop()">رجوع</button>
</div>

<div class="overlay hidden" id="builderScreen">
  <div class="shopTitle">🔧 اصنع صاروخك</div>
  <div class="builderBox">
    <canvas class="builderPreview" id="builderPreview" width="780" height="250"></canvas>
    <input class="nameInput" id="customName" placeholder="سمّي صاروخك" maxlength="20">
    <div class="builderControls" style="margin-top:18px;">
      <div class="controlGroup">
        <div class="controlLabel">لون الجسم</div>
        <div class="colorPicker" id="bodyColors"></div>
      </div>
      <div class="controlGroup">
        <div class="controlLabel">لون الحواشف</div>
        <div class="colorPicker" id="finColors"></div>
      </div>
      <div class="controlGroup">
        <div class="controlLabel">شكل الراس</div>
        <div class="shapePicker" id="noseShapes">
          <div class="shapeBtn selected" data-shape="sharp">مدبب</div>
          <div class="shapeBtn" data-shape="round">دائري</div>
          <div class="shapeBtn" data-shape="flat">مسطح</div>
        </div>
      </div>
      <div class="controlGroup">
        <div class="controlLabel">لون النار</div>
        <div class="colorPicker" id="fireColors"></div>
      </div>
    </div>
    <div style="display:flex; gap:12px; margin-top:22px; justify-content:center; flex-wrap:wrap;">
      <button class="menuBtn small" onclick="saveCustomRocket()">💾 احفظ واستخدم</button>
      <button class="menuBtn small" onclick="closeBuilder()">رجوع</button>
    </div>
  </div>
</div>

<div class="overlay hidden" id="resultScreen">
  <div class="resultBox">
    <div class="resultTitle" id="resultTitle">انتهت المهمة</div>
    <div class="resultReward" id="resultReward"></div>
    <button class="menuBtn" onclick="nextMission()">المهمة التالية</button>
    <button class="menuBtn small" onclick="exitToMenu()">القائمة</button>
  </div>
</div>

<script>
/* =========================================================
   الصاروخ المتنكر - النسخة الأسطورية
   ========================================================= */

// ---------- State ----------
const state = {
  coins: parseInt(localStorage.getItem('rk_coins') || '300'),
  ownedRockets: JSON.parse(localStorage.getItem('rk_owned') || '["starter"]'),
  equippedRocket: localStorage.getItem('rk_equipped') || 'starter',
  customRocket: JSON.parse(localStorage.getItem('rk_custom') || 'null'),
  missionIndex: parseInt(localStorage.getItem('rk_mission') || '0'),
  muted: localStorage.getItem('rk_muted') === '1',
  currentMission: null,
  playing: false,
  detected: false,
  alertTimer: 0,
  timeOfDay: 0.5, // 0 = night, 1 = day
  screenShake: 0
};

function save() {
  localStorage.setItem('rk_coins', state.coins);
  localStorage.setItem('rk_owned', JSON.stringify(state.ownedRockets));
  localStorage.setItem('rk_equipped', state.equippedRocket);
  localStorage.setItem('rk_custom', JSON.stringify(state.customRocket));
  localStorage.setItem('rk_mission', state.missionIndex);
  localStorage.setItem('rk_muted', state.muted ? '1' : '0');
  updateCoinsUI();
}
function updateCoinsUI() {
  document.getElementById('coinsDisplay').textContent = '💰 ' + state.coins;
}
updateCoinsUI();

// ---------- Canvas ----------
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let W = 0, H = 0, DPR = Math.min(window.devicePixelRatio || 1, 2);

function resize() {
  W = window.innerWidth;
  H = window.innerHeight;
  canvas.width = W * DPR;
  canvas.height = H * DPR;
  canvas.style.width = W + 'px';
  canvas.style.height = H + 'px';
  ctx.setTransform(DPR, 0, 0, DPR, 0, 0);
}
window.addEventListener('resize', resize);
resize();

// ---------- Menu Background Animation ----------
const menuBg = document.getElementById('menuBg');
const menuBgCtx = menuBg.getContext('2d');
const menuStars = [];
for (let i = 0; i < 100; i++) {
  menuStars.push({ x: Math.random(), y: Math.random(), size: Math.random() * 2 + 0.5, speed: Math.random() * 0.0005 + 0.0002, twinkle: Math.random() * Math.PI * 2 });
}
const menuRockets = [];
for (let i = 0; i < 3; i++) {
  menuRockets.push({ x: Math.random(), y: 0.3 + Math.random() * 0.4, vx: 0.0003 + Math.random() * 0.0003, angle: -0.2 + Math.random() * 0.4, size: 0.5 + Math.random() * 0.5 });
}

function animateMenuBg() {
  if (document.getElementById('mainMenu').classList.contains('hidden')) {
    requestAnimationFrame(animateMenuBg);
    return;
  }
  menuBg.width = W;
  menuBg.height = H;
  menuBgCtx.clearRect(0, 0, W, H);
  
  // Stars
  const t = Date.now() * 0.001;
  for (const s of menuStars) {
    s.x -= s.speed;
    if (s.x < 0) s.x = 1;
    const alpha = 0.5 + Math.sin(t * 2 + s.twinkle) * 0.5;
    menuBgCtx.fillStyle = `rgba(255,255,255,${alpha})`;
    menuBgCtx.beginPath();
    menuBgCtx.arc(s.x * W, s.y * H, s.size, 0, Math.PI * 2);
    menuBgCtx.fill();
  }
  
  // Rockets flying across
  for (const r of menuRockets) {
    r.x += r.vx;
    if (r.x > 1.2) r.x = -0.2;
    drawRocket(menuBgCtx, r.x * W, r.y * H, r.angle, rocketCatalog[0], r.size * 0.8, true);
  }
  
  requestAnimationFrame(animateMenuBg);
}
animateMenuBg();

// ---------- Sound ----------
let audioCtx = null;
let masterGain = null;
let engineNode = null;
let windNode = null;

function initAudio() {
  if (audioCtx) return;
  try {
    audioCtx = new (window.AudioContext || window.webkitAudioContext)();
    masterGain = audioCtx.createGain();
    masterGain.gain.value = state.muted ? 0 : 0.6;
    masterGain.connect(audioCtx.destination);
  } catch(e) {}
}

function playTone(freq, dur, type='sine', vol=0.3) {
  if (!audioCtx || state.muted) return;
  const osc = audioCtx.createOscillator();
  const g = audioCtx.createGain();
  osc.type = type;
  osc.frequency.value = freq;
  g.gain.value = 0;
  g.gain.linearRampToValueAtTime(vol, audioCtx.currentTime + 0.02);
  g.gain.linearRampToValueAtTime(0, audioCtx.currentTime + dur);
  osc.connect(g); g.connect(masterGain);
  osc.start(); osc.stop(audioCtx.currentTime + dur);
}

function playNoise(dur, vol=0.4, filterFreq=1000) {
  if (!audioCtx || state.muted) return;
  const bufferSize = Math.floor(audioCtx.sampleRate * dur);
  const buffer = audioCtx.createBuffer(1, bufferSize, audioCtx.sampleRate);
  const data = buffer.getChannelData(0);
  for (let i=0; i<bufferSize; i++) data[i] = Math.random()*2-1;
  const src = audioCtx.createBufferSource();
  src.buffer = buffer;
  const filter = audioCtx.createBiquadFilter

Game Source: الصاروخ المتنكر - النسخة الأسطورية

Creator: ChromeFlame24

Libraries: none

Complexity: complex (335 lines, 19.9 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: game-chromeflame24-mwnnkp7f" to link back to the original. Then publish at arcadelab.ai/publish.