{"id":2,"date":"2026-05-04T08:46:39","date_gmt":"2026-05-04T08:46:39","guid":{"rendered":"https:\/\/sahizameen.in\/?page_id=2"},"modified":"2026-05-04T09:30:42","modified_gmt":"2026-05-04T09:30:42","slug":"sample-page","status":"publish","type":"page","link":"https:\/\/sahizameen.in\/?page_id=2","title":{"rendered":"home"},"content":{"rendered":"\n<div style=\"background:#0a0f1e; padding:15px; border-radius:18px; text-align:center; font-family:monospace; max-width:100%; overflow-x:auto;\">\n  <canvas id=\"contraCanvasFinal\" width=\"650\" height=\"350\" style=\"background:#1c3e2d; border-radius:12px; box-shadow:0 5px 15px black; width:100%; height:auto; max-width:650px; cursor:pointer;\"><\/canvas>\n  <div style=\"display:flex; justify-content:space-between; background:#000000aa; color:#ffcc88; padding:8px 16px; border-radius:30px; margin-top:10px;\">\n    <span>\u2764\ufe0f HEALTH: <span id=\"cHealthF\">5<\/span><\/span>\n    <span>\ud83c\udfaf SCORE: <span id=\"cScoreF\">0<\/span><\/span>\n    <span>\ud83d\udd2b AMMO: \u221e<\/span>\n  <\/div>\n  <div style=\"margin-top:10px; display:flex; gap:10px; justify-content:center; flex-wrap:wrap;\">\n    <button class=\"gameBtn\" data-action=\"left\" style=\"background:#ffaa33; border:none; padding:10px 24px; border-radius:40px; font-weight:bold; font-size:18px;\">\u25c0 LEFT<\/button>\n    <button class=\"gameBtn\" data-action=\"right\" style=\"background:#ffaa33; border:none; padding:10px 24px; border-radius:40px; font-weight:bold; font-size:18px;\">RIGHT \u25b6<\/button>\n    <button class=\"gameBtn\" data-action=\"fire\" style=\"background:#ff4444; border:none; padding:10px 28px; border-radius:40px; font-weight:bold; font-size:18px;\">\ud83d\udd25 FIRE<\/button>\n    <button id=\"restartBtnFinal\" style=\"background:#44aa44; border:none; padding:10px 22px; border-radius:40px; font-weight:bold; font-size:18px;\">\u27f3 RESTART<\/button>\n  <\/div>\n  <div style=\"font-size:12px; color:#aaa; margin-top:10px;\">\ud83d\udc49 \u092e\u094b\u092c\u093e\u0907\u0932: \u092c\u091f\u0928 \u0926\u092c\u093e\u0915\u0930 \u0930\u0916\u0947\u0902 \/ \u0926\u092c\u093e\u090f\u0901 | PC: \u2190 \u2192 + SPACE<\/div>\n<\/div>\n\n<script>\n(function(){\n  const canvas = document.getElementById('contraCanvasFinal');\n  const ctx = canvas.getContext('2d');\n  \n  let player = { x: 60, y: 300, w: 26, h: 26, health: 5, invincible: 0 };\n  let bullets = [];\n  let enemies = [];\n  let score = 0;\n  let gameOver = false;\n  let fireCd = 0;\n  let spawnTimer = 0;\n  \n  let leftActive = false;\n  let rightActive = false;\n  let fireRequest = false;\n  \n  const updateUI = () => {\n    document.getElementById('cHealthF').innerText = player.health;\n    document.getElementById('cScoreF').innerText = score;\n  };\n  \n  const shoot = () => {\n    if(gameOver) return;\n    bullets.push({ x: player.x+player.w\/2-4, y: player.y+12, w: 12, h: 5, speed: 8 });\n  };\n  \n  const restartGame = () => {\n    gameOver = false;\n    player = { x: 60, y: 300, w: 26, h: 26, health: 5, invincible: 0 };\n    bullets = [];\n    enemies = [];\n    score = 0;\n    fireCd = 0;\n    spawnTimer = 0;\n    leftActive = false;\n    rightActive = false;\n    updateUI();\n  };\n  \n  const spawnEnemy = () => {\n    enemies.push({ x: canvas.width-45, y: 298+Math.random()*20, w: 28, h: 28, hp: 1 });\n  };\n  \n  function updateGame(){\n    if(gameOver) return;\n    \n    \/\/ movement (\u092e\u094b\u092c\u093e\u0907\u0932 \u0914\u0930 PC \u0926\u094b\u0928\u094b\u0902)\n    if(leftActive && player.x > 8) player.x -= 4.5;\n    if(rightActive && player.x < canvas.width - player.w - 8) player.x += 4.5;\n    \n    \/\/ shooting\n    if(fireCd > 0) fireCd--;\n    if(fireRequest && fireCd===0 && !gameOver){\n      shoot();\n      fireCd = 12;\n      fireRequest = false;  \/\/ \u090f\u0915 \u092c\u093e\u0930 \u092b\u093e\u092f\u0930 \u0915\u0930 \u0926\u094b, \u092c\u093e\u0930-\u092c\u093e\u0930 \u0928\u0939\u0940\u0902\n    }\n    \n    \/\/ bullets move\n    for(let i=0; i<bullets.length; i++){\n      bullets[i].x += bullets[i].speed;\n      if(bullets[i].x > canvas.width) { bullets.splice(i,1); i--; }\n    }\n    \n    \/\/ enemies move + bullet collision\n    for(let i=0; i<enemies.length; i++){\n      let e = enemies[i];\n      e.x -= 2.3;\n      for(let j=0; j<bullets.length; j++){\n        let b = bullets[j];\n        if(b.x < e.x+e.w &#038;&#038; b.x+b.w > e.x && b.y < e.y+e.h &#038;&#038; b.y+b.h > e.y){\n          enemies.splice(i,1);\n          bullets.splice(j,1);\n          score += 10;\n          updateUI();\n          i--; break;\n        }\n      }\n    }\n    \n    \/\/ enemy out of screen -> damage\n    for(let i=0; i<enemies.length; i++){\n      if(enemies[i].x + enemies[i].w < 0){\n        enemies.splice(i,1);\n        if(player.invincible<=0 &#038;&#038; !gameOver){\n          player.health--;\n          player.invincible=22;\n          updateUI();\n          if(player.health<=0){ gameOver=true; updateUI(); }\n        }\n        i--;\n      }\n    }\n    \n    \/\/ collision player vs enemy\n    for(let i=0; i<enemies.length; i++){\n      let e=enemies[i];\n      if(player.x < e.x+e.w &#038;&#038; player.x+player.w > e.x && player.y < e.y+e.h &#038;&#038; player.y+player.h > e.y){\n        if(player.invincible<=0 &#038;&#038; !gameOver){\n          player.health--;\n          player.invincible=22;\n          updateUI();\n          if(player.health<=0){ gameOver=true; updateUI(); }\n        }\n        enemies.splice(i,1);\n        i--;\n      }\n    }\n    \n    if(player.invincible>0) player.invincible--;\n    \n    \/\/ spawn enemies\n    if(spawnTimer<=0 &#038;&#038; !gameOver &#038;&#038; enemies.length<5){\n      spawnEnemy();\n      spawnTimer = 45 + Math.random()*35;\n    } else { spawnTimer--; }\n  }\n  \n  function draw(){\n    ctx.clearRect(0,0,canvas.width,canvas.height);\n    \/\/ ground\n    ctx.fillStyle=\"#5a3e1a\"; ctx.fillRect(0,340,canvas.width,50);\n    ctx.fillStyle=\"#bc9a6c\"; ctx.fillRect(0,348,canvas.width,10);\n    \/\/ player\n    ctx.fillStyle=\"#2f6b2f\"; ctx.fillRect(player.x,player.y,player.w,player.h);\n    ctx.fillStyle=\"#7b3f00\"; ctx.fillRect(player.x+7,player.y-5,12,7);\n    ctx.fillStyle=\"#d4b87a\"; ctx.fillRect(player.x+18,player.y+9,7,8);\n    if(player.invincible>0 && (Date.now()\/100)%2<1){\n      ctx.fillStyle=\"#ffffaa\"; ctx.globalAlpha=0.6;\n      ctx.fillRect(player.x-2,player.y-2,player.w+4,player.h+4);\n      ctx.globalAlpha=1;\n    }\n    \/\/ bullets\n    ctx.fillStyle=\"#ffcc44\";\n    for(let b of bullets) ctx.fillRect(b.x,b.y,b.w,b.h);\n    \/\/ enemies\n    for(let e of enemies){\n      ctx.fillStyle=\"#a52244\"; ctx.fillRect(e.x,e.y,e.w,e.h);\n      ctx.fillStyle=\"#000\"; ctx.fillRect(e.x+6,e.y+6,6,7); ctx.fillRect(e.x+15,e.y+6,6,7);\n    }\n    if(gameOver){\n      ctx.font=\"bold 24px monospace\"; ctx.fillStyle=\"#ffcc88\";\n      ctx.fillText(\"GAME OVER\", canvas.width\/2-90, canvas.height\/2-30);\n      ctx.font=\"14px monospace\"; ctx.fillStyle=\"#ddd\";\n      ctx.fillText(\"RESTART\", canvas.width\/2-30, canvas.height\/2+15);\n    }\n  }\n  \n  function gameloop(){ updateGame(); draw(); requestAnimationFrame(gameloop); }\n  gameloop();\n  \n  \/\/ ---------- PC Keyboard ----------\n  window.addEventListener('keydown',(e)=>{\n    if(e.key==='ArrowLeft'){ leftActive=true; e.preventDefault();}\n    if(e.key==='ArrowRight'){ rightActive=true; e.preventDefault();}\n    if(e.key===' '|| e.key==='Space'){ fireRequest=true; e.preventDefault();}\n    if(e.key==='r'|| e.key==='R'){ restartGame();}\n  });\n  window.addEventListener('keyup',(e)=>{\n    if(e.key==='ArrowLeft') leftActive=false;\n    if(e.key==='ArrowRight') rightActive=false;\n    if(e.key===' '|| e.key==='Space') fireRequest=false;\n  });\n  \n  \/\/ ---------- Mobile Touch (\u092c\u091f\u0928 \u0926\u092c\u093e\u0915\u0930 \u0930\u0916\u0928\u093e \/ \u091b\u094b\u0921\u093c\u0928\u093e) ----------\n  const leftBtn = document.querySelector('[data-action=\"left\"]');\n  const rightBtn = document.querySelector('[data-action=\"right\"]');\n  const fireBtn = document.querySelector('[data-action=\"fire\"]');\n  \n  function attachTouch(el, onStart, onEnd){\n    if(!el) return;\n    el.addEventListener('touchstart', (e) => { e.preventDefault(); onStart(); });\n    el.addEventListener('touchend', (e) => { e.preventDefault(); onEnd(); });\n    el.addEventListener('touchcancel', (e) => { e.preventDefault(); onEnd(); });\n    \/\/ \u092e\u093e\u0909\u0938 \u0915\u0947 \u0932\u093f\u090f \u092d\u0940 (PC \u091f\u0947\u0938\u094d\u091f)\n    el.addEventListener('mousedown', (e) => { e.preventDefault(); onStart(); });\n    el.addEventListener('mouseup', () => { onEnd(); });\n  }\n  \n  attachTouch(leftBtn, () => { leftActive = true; }, () => { leftActive = false; });\n  attachTouch(rightBtn, () => { rightActive = true; }, () => { rightActive = false; });\n  attachTouch(fireBtn, () => { \n    if(!gameOver && fireCd===0) fireRequest = true; \n  }, () => { \n    \/\/ \u0915\u0941\u091b \u0928\u0939\u0940\u0902, fireRequest \u0905\u092a\u0928\u0947 \u0906\u092a reset \u0939\u094b\u0917\u093e updateGame \u092e\u0947\u0902\n  });\n  \n  document.getElementById('restartBtnFinal').addEventListener('click', () => { restartGame(); });\n  document.getElementById('restartBtnFinal').addEventListener('touchstart', (e) => { e.preventDefault(); restartGame(); });\n  \n  \/\/ \u0915\u0948\u0928\u0935\u093e\u0938 \u092a\u0930 \u0915\u094d\u0932\u093f\u0915 \u0938\u0947 \u092d\u0940 \u092b\u093e\u092f\u0930 (optional)\n  canvas.addEventListener('click', () => {\n    if(!gameOver && fireCd===0) fireRequest = true;\n  });\n  canvas.addEventListener('touchstart', (e) => { e.preventDefault(); if(!gameOver && fireCd===0) fireRequest = true; });\n  \n})();\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>\u2764\ufe0f HEALTH: 5 \ud83c\udfaf SCORE: 0 \ud83d\udd2b AMMO: \u221e \u25c0 LEFT RIGHT \u25b6 \ud83d\udd25 FIRE \u27f3 RESTART \ud83d\udc49 \u092e\u094b\u092c\u093e\u0907\u0932: \u092c\u091f\u0928 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-2","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/sahizameen.in\/index.php?rest_route=\/wp\/v2\/pages\/2","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sahizameen.in\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sahizameen.in\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sahizameen.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sahizameen.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2"}],"version-history":[{"count":6,"href":"https:\/\/sahizameen.in\/index.php?rest_route=\/wp\/v2\/pages\/2\/revisions"}],"predecessor-version":[{"id":23,"href":"https:\/\/sahizameen.in\/index.php?rest_route=\/wp\/v2\/pages\/2\/revisions\/23"}],"wp:attachment":[{"href":"https:\/\/sahizameen.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}