{"id":115,"date":"2026-03-06T17:45:30","date_gmt":"2026-03-06T17:45:30","guid":{"rendered":"https:\/\/dabudi.si\/?page_id=115"},"modified":"2026-03-06T18:02:18","modified_gmt":"2026-03-06T18:02:18","slug":"zvezdice-igra","status":"publish","type":"page","link":"https:\/\/dabudi.si\/index.php\/zvezdice-igra\/","title":{"rendered":"zvezdice (IGRA)"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"sl\">\n<head>\n<meta charset=\"UTF-8\">\n<title>Modri Hr\u010dek &#8211; Lov na Zvezdice<\/title>\n<style>\nhtml, body {\n  margin:0;\n  padding:0;\n  overflow:hidden;\n  height:100%;\n  background: linear-gradient(to bottom, #87ceeb 0%, #00ced1 100%);\n  font-family: sans-serif;\n}\n\n#startBtn {\n  position:absolute;\n  top:50%;\n  left:50%;\n  transform:translate(-50%,-50%);\n  padding:20px 40px;\n  font-size:28px;\n  background:#1E90FF;\n  color:white;\n  border:none;\n  border-radius:10px;\n  cursor:pointer;\n  box-shadow:0 5px 15px rgba(0,0,0,0.3);\n}\n\n#startBtn:hover {\n  background:#104E8B;\n}\n\n#score {\n  position:absolute;\n  top:10px;\n  left:10px;\n  font-size:28px;\n  color:#004080;\n  font-weight:bold;\n  text-shadow:1px 1px 2px white;\n}\n\ncanvas {display:block;}\n<\/style>\n<\/head>\n<body>\n\n<div id=\"score\">Zvezdice: 0<\/div>\n<canvas id=\"gameCanvas\"><\/canvas>\n<button id=\"startBtn\">Za\u010dni igro<\/button>\n\n<script>\nconst canvas = document.getElementById(\"gameCanvas\");\nconst ctx = canvas.getContext(\"2d\");\nlet gameStarted = false;\nlet animationFrame;\n\n\/\/ fullscreen canvas\nfunction resizeCanvas() {\n  canvas.width = window.innerWidth;\n  canvas.height = window.innerHeight;\n}\nwindow.addEventListener('resize', resizeCanvas);\nresizeCanvas();\n\nlet score = 0;\n\n\/\/ Player - cartoon hr\u010dek\nconst player = {x:150, y:0, width:60, height:60, dy:0, gravity:0.7, jump:-14, grounded:false, color:'#1E90FF'};\nplayer.y = canvas.height - player.height - 20;\n\n\/\/ Stars & obstacles\nlet stars = [];\nlet obstacles = [];\n\n\/\/ Spawn functions\nfunction spawnStar() {\n  const size = 30;\n  const x = canvas.width + size;\n  const y = canvas.height - 50 - Math.random()*200;\n  stars.push({x,y,size});\n}\nfunction spawnObstacle() {\n  const width=50, height=80;\n  const x = canvas.width + width;\n  const y = canvas.height - height - 20;\n  obstacles.push({x,y,width,height});\n}\n\n\/\/ Background drawing\nfunction drawBackground() {\n  ctx.fillStyle = '#87CEEB';\n  ctx.fillRect(0,0,canvas.width,canvas.height);\n  \/\/ tla z rahlo teksturo\n  ctx.fillStyle = '#3CB371';\n  ctx.fillRect(0, canvas.height-20, canvas.width, 20);\n}\n\n\/\/ Cartoon hr\u010dek\nfunction drawPlayer(){\n  \/\/ telo\n  ctx.fillStyle = player.color;\n  ctx.beginPath();\n  ctx.ellipse(player.x+player.width\/2, player.y+player.height\/2, player.width\/2, player.height\/2,0,0,Math.PI*2);\n  ctx.fill();\n  \/\/ o\u010di\n  ctx.fillStyle='white';\n  ctx.beginPath(); ctx.ellipse(player.x+18,player.y+20,8,12,0,0,Math.PI*2); ctx.fill();\n  ctx.beginPath(); ctx.ellipse(player.x+42,player.y+20,8,12,0,0,Math.PI*2); ctx.fill();\n  ctx.fillStyle='black';\n  ctx.beginPath(); ctx.ellipse(player.x+18,player.y+22,4,6,0,0,Math.PI*2); ctx.fill();\n  ctx.beginPath(); ctx.ellipse(player.x+42,player.y+22,4,6,0,0,Math.PI*2); ctx.fill();\n  \/\/ nasmeh\n  ctx.strokeStyle='black'; ctx.lineWidth=2;\n  ctx.beginPath(); ctx.arc(player.x+30,player.y+35,12,0,Math.PI); ctx.stroke();\n}\n\n\/\/ Stars\nfunction drawStars() {\n  stars.forEach(star=>{\n    ctx.fillStyle='yellow';\n    ctx.beginPath();\n    ctx.arc(star.x, star.y, star.size\/2,0,Math.PI*2);\n    ctx.fill();\n  });\n}\n\n\/\/ Obstacles\nfunction drawObstacles() {\n  ctx.fillStyle='#228B22';\n  obstacles.forEach(obs=>{\n    ctx.fillRect(obs.x, obs.y, obs.width, obs.height);\n  });\n}\n\n\/\/ Game loop\nfunction update(){\n  drawBackground();\n\n  \/\/ Player gravity\n  player.dy += player.gravity;\n  player.y += player.dy;\n  if(player.y + player.height >= canvas.height - 20){\n    player.y = canvas.height - 20 - player.height;\n    player.dy = 0;\n    player.grounded = true;\n  } else player.grounded = false;\n\n  \/\/ Stars movement & collision\n  stars.forEach((star,i)=>{\n    star.x -=6;\n    if(star.x + star.size < 0) stars.splice(i,1);\n    if(player.x < star.x + star.size &#038;&#038; player.x + player.width > star.x &&\n       player.y < star.y + star.size &#038;&#038; player.y + player.height > star.y){\n         stars.splice(i,1);\n         score++;\n         document.getElementById(\"score\").textContent = \"Zvezdice: \"+score;\n       }\n  });\n\n  \/\/ Obstacles movement & collision\n  obstacles.forEach((obs,i)=>{\n    obs.x -=7;\n    if(obs.x + obs.width < 0) obstacles.splice(i,1);\n    if(player.x < obs.x + obs.width &#038;&#038; player.x+player.width>obs.x &&\n       player.y<obs.y+obs.height &#038;&#038; player.y+player.height>obs.y){\n         alert(\"Hr\u010dek se je spotaknil! Zvezdice: \"+score);\n         location.reload();\n       }\n  });\n\n  drawStars();\n  drawObstacles();\n  drawPlayer();\n\n  animationFrame = requestAnimationFrame(update);\n}\n\n\/\/ Jump\nwindow.addEventListener('keydown',e=>{\n  if(!gameStarted) return;\n  if(e.code==='Space'||e.code==='ArrowUp'){if(player.grounded) player.dy = player.jump;}\n});\n\n\/\/ Spawn intervals\nlet starInterval, obsInterval;\n\n\/\/ Start game button\ndocument.getElementById(\"startBtn\").onclick = ()=>{\n  gameStarted = true;\n  document.getElementById(\"startBtn\").style.display = 'none';\n  \/\/ spawn intervals\n  starInterval = setInterval(spawnStar,1500);\n  obsInterval = setInterval(spawnObstacle,2500);\n  update();\n};\n\n<\/script>\n<\/body>\n<\/html>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Modri Hr\u010dek &#8211; Lov na Zvezdice Zvezdice: 0 Za\u010dni igro<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-115","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/comments?post=115"}],"version-history":[{"count":7,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages\/115\/revisions"}],"predecessor-version":[{"id":122,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages\/115\/revisions\/122"}],"wp:attachment":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/media?parent=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}