{"id":593,"date":"2025-01-27T13:08:49","date_gmt":"2025-01-27T13:08:49","guid":{"rendered":"https:\/\/shaplakanon.com\/learnwithfun\/?page_id=593"},"modified":"2025-02-02T22:49:10","modified_gmt":"2025-02-02T22:49:10","slug":"balloons","status":"publish","type":"page","link":"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/","title":{"rendered":"Balloons"},"content":{"rendered":"\n\n\n\n \n \n Balloon Pop Game<\/title>\n <style>\n body, html {\n margin: 0;\n padding: 0;\n overflow: hidden;\n height: 100%;\n background: #87CEEB!important;\n }\n\n #gameArea {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n }\n\n .scoreBoard {\n position: absolute;\n top: 10px;\n left: 10px;\n color: #fff;\n font-size: 24px;\n font-family: Arial, sans-serif;\n z-index: 100;\n }\n\n .timer {\n position: absolute;\n top: 40px;\n left: 10px;\n color: #fff;\n font-size: 24px;\n font-family: Arial, sans-serif;\n z-index: 100;\n }\n\n .balloon {\n position: absolute;\n width: 50px;\n height: 70px;\n background-color: red;\n border-radius: 50%;\n cursor: pointer;\n user-select: none;\n padding: 10px; \/* Invisible padding to increase click area *\/\n box-sizing: content-box; \/* Ensures the visual size doesn't change *\/\n display: flex;\n justify-content: center;\n align-items: center;\n color: white;\n font-size: 20px;\n font-family: Arial, sans-serif;\n }\n\n .balloon:hover {\n opacity: 0.9;\n }\n\n <\/style>\n<\/head>\n<body>\n <div id=\"gameArea\">\n <div class=\"scoreBoard\">\n Score: <span id=\"score\">0<\/span>\n <\/div>\n <div class=\"timer\">\n Time Left: <span id=\"timeLeft\">60<\/span>\n <\/div>\n <\/div>\n<script>\n const gameArea = document.getElementById('gameArea');\n const scoreDisplay = document.getElementById('score');\n const timeLeftDisplay = document.getElementById('timeLeft');\n let score = 0;\n let gameDuration = 60; \/\/ Game duration in seconds initialized to 60\n let moveSpeed = 1.5; \/\/ Initial speed of balloon movement\n let maxSpeed = 5; \/\/ Maximum speed to prevent it from becoming too fast\n let gameInterval, createBalloonInterval;\n\n function startGame() {\n gameInterval = setInterval(updateTimer, 1000);\n createBalloonInterval = setInterval(createBalloon, 800); \/\/ Create a balloon every 800ms\n }\n\n function updateTimer() {\n gameDuration--;\n timeLeftDisplay.textContent = gameDuration + ' sec';\n if (gameDuration % 10 === 0 && moveSpeed < maxSpeed) { \/\/ Increase speed every 10 seconds if below max speed\n moveSpeed += 0.5;\n }\n if (gameDuration <= 0) {\n endGame();\n }\n }\n\n function createBalloon() {\n const balloon = document.createElement('div');\n balloon.classList.add('balloon');\n\n const size = Math.random() * (60 - 30) + 30;\n balloon.style.width = balloon.style.height = `${size}px`;\n balloon.style.left = `${Math.random() * (innerWidth - size)}px`;\n\n const balloonType = Math.random();\n if (balloonType < 0.8) {\n balloon.dataset.points = '1'; \/\/ Normal balloon\n balloon.style.backgroundColor = randomColor();\n } else if (balloonType < 0.95) {\n balloon.dataset.points = '3'; \/\/ More points\n balloon.style.backgroundColor = 'gold'; \/\/ Different color for higher point balloon\n } else {\n balloon.dataset.points = 'time'; \/\/ Time balloon\n balloon.style.backgroundColor = 'green';\n }\n\n \/\/ Set text on balloon (either a number or letter)\n const textContent = Math.random() < 0.5 ? String.fromCharCode(65 + Math.floor(Math.random() * 26)) : Math.floor(Math.random() * 100).toString();\n balloon.textContent = textContent;\n\n gameArea.appendChild(balloon);\n moveBalloon(balloon, moveSpeed);\n }\n\n function randomColor() {\n return `hsl(${Math.random() * 360}, 100%, 50%)`;\n }\n\n function moveBalloon(balloon, speed) {\n let yPos = innerHeight;\n const interval = setInterval(() => {\n yPos -= speed;\n balloon.style.top = `${yPos}px`;\n\n if (yPos < -50) {\n balloon.remove();\n clearInterval(interval);\n }\n }, 20);\n }\n\n function popBalloon(event) {\n let balloon = event.target;\n if (!balloon.classList.contains('balloon')) {\n balloon = balloon.closest('.balloon');\n }\n if (balloon) {\n const points = balloon.dataset.points;\n if (points === 'time') {\n gameDuration += 10; \/\/ Adds 10 seconds\n } else {\n score += parseInt(points, 10);\n }\n scoreDisplay.textContent = score;\n balloon.remove();\n }\n }\n\n function endGame() {\n clearInterval(gameInterval);\n clearInterval(createBalloonInterval);\n alert('Game Over! Your score: ' + score);\n document.removeEventListener('click', popBalloonEvent);\n }\n\n function popBalloonEvent(event) {\n if (event.target.classList.contains('balloon') || event.target.closest('.balloon')) {\n popBalloon(event);\n }\n }\n\n document.addEventListener('click', popBalloonEvent);\n startGame();\n<\/script>\n\n\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Balloon Pop Game Score: 0 Time Left: 60<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_canvas","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":"","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":"set","ast-page-background-enabled":"default","ast-page-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":"","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-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":"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":""},"mobile":{"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":""}},"footnotes":""},"class_list":["post-593","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Balloons - Learn with Fun<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Balloons - Learn with Fun\" \/>\n<meta property=\"og:description\" content=\"Balloon Pop Game Score: 0 Time Left: 60\" \/>\n<meta property=\"og:url\" content=\"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn with Fun\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-02T22:49:10+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/\",\"url\":\"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/\",\"name\":\"Balloons - Learn with Fun\",\"isPartOf\":{\"@id\":\"https:\/\/shaplakanon.com\/learnwithfun\/#website\"},\"datePublished\":\"2025-01-27T13:08:49+00:00\",\"dateModified\":\"2025-02-02T22:49:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/shaplakanon.com\/learnwithfun\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Balloons\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/shaplakanon.com\/learnwithfun\/#website\",\"url\":\"https:\/\/shaplakanon.com\/learnwithfun\/\",\"name\":\"Learn with Fun\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/shaplakanon.com\/learnwithfun\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Balloons - Learn with Fun","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/","og_locale":"en_US","og_type":"article","og_title":"Balloons - Learn with Fun","og_description":"Balloon Pop Game Score: 0 Time Left: 60","og_url":"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/","og_site_name":"Learn with Fun","article_modified_time":"2025-02-02T22:49:10+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/","url":"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/","name":"Balloons - Learn with Fun","isPartOf":{"@id":"https:\/\/shaplakanon.com\/learnwithfun\/#website"},"datePublished":"2025-01-27T13:08:49+00:00","dateModified":"2025-02-02T22:49:10+00:00","breadcrumb":{"@id":"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/shaplakanon.com\/learnwithfun\/balloons\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/shaplakanon.com\/learnwithfun\/balloons\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/shaplakanon.com\/learnwithfun\/"},{"@type":"ListItem","position":2,"name":"Balloons"}]},{"@type":"WebSite","@id":"https:\/\/shaplakanon.com\/learnwithfun\/#website","url":"https:\/\/shaplakanon.com\/learnwithfun\/","name":"Learn with Fun","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/shaplakanon.com\/learnwithfun\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/shaplakanon.com\/learnwithfun\/wp-json\/wp\/v2\/pages\/593","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shaplakanon.com\/learnwithfun\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/shaplakanon.com\/learnwithfun\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/shaplakanon.com\/learnwithfun\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shaplakanon.com\/learnwithfun\/wp-json\/wp\/v2\/comments?post=593"}],"version-history":[{"count":3,"href":"https:\/\/shaplakanon.com\/learnwithfun\/wp-json\/wp\/v2\/pages\/593\/revisions"}],"predecessor-version":[{"id":598,"href":"https:\/\/shaplakanon.com\/learnwithfun\/wp-json\/wp\/v2\/pages\/593\/revisions\/598"}],"wp:attachment":[{"href":"https:\/\/shaplakanon.com\/learnwithfun\/wp-json\/wp\/v2\/media?parent=593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}