{"id":34,"date":"2026-04-27T18:53:54","date_gmt":"2026-04-27T18:53:54","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/h_yusko\/?p=34"},"modified":"2026-04-27T18:53:54","modified_gmt":"2026-04-27T18:53:54","slug":"free-friday-4-24-26","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/h_yusko\/2026\/04\/27\/free-friday-4-24-26\/","title":{"rendered":"Free Friday 4\/24\/26"},"content":{"rendered":"\n<p>This Free Friday, I worked on developing my clicker game in which players earn points by clicking a button. As players accumulate points, they can purchase an auto clicker that automatically generates clicks over time, increasing their point total even when they&#8217;re not actively playing. Additionally, players can buy multipliers that boost the effectiveness of both manual and auto clicks. Both the manual clicking and auto clicker upgrades can be leveled up to a maximum of 10, allowing for greater efficiency and higher point gains. However, the multiplier upgrade does not have a cap, so players can continue increasing it indefinitely to maximize their score.<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"956\" src=\"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-content\/uploads\/2026\/04\/clicker-game-.png\" alt=\"\" class=\"wp-image-36\" srcset=\"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-content\/uploads\/2026\/04\/clicker-game-.png 962w, https:\/\/theroyalscode.com\/students\/h_yusko\/wp-content\/uploads\/2026\/04\/clicker-game--300x298.png 300w, https:\/\/theroyalscode.com\/students\/h_yusko\/wp-content\/uploads\/2026\/04\/clicker-game--150x150.png 150w, https:\/\/theroyalscode.com\/students\/h_yusko\/wp-content\/uploads\/2026\/04\/clicker-game--768x763.png 768w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"920\" height=\"859\" src=\"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-content\/uploads\/2026\/04\/clicker-game-ss.png\" alt=\"\" class=\"wp-image-37\" srcset=\"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-content\/uploads\/2026\/04\/clicker-game-ss.png 920w, https:\/\/theroyalscode.com\/students\/h_yusko\/wp-content\/uploads\/2026\/04\/clicker-game-ss-300x280.png 300w, https:\/\/theroyalscode.com\/students\/h_yusko\/wp-content\/uploads\/2026\/04\/clicker-game-ss-768x717.png 768w\" sizes=\"auto, (max-width: 920px) 100vw, 920px\" \/><\/figure>\n\n\n\n<p>&nbsp; }<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>const scoreDiv = document.getElementById(&#8216;score&#8217;);<\/p>\n\n\n\n<p>\/\/ Generate multipliers UI<\/p>\n\n\n\n<p>const container = document.getElementById(&#8216;multiplierContainer&#8217;);<\/p>\n\n\n\n<p>for (let i=0; i&lt;4; i++) {<\/p>\n\n\n\n<p>&nbsp; const div = document.createElement(&#8216;div&#8217;);<\/p>\n\n\n\n<p>&nbsp; div.className = &#8216;multiplier&#8217;;<\/p>\n\n\n\n<p>&nbsp; div.id = &#8216;multiplierDiv&#8217; + i;<\/p>\n\n\n\n<p>&nbsp; div.innerHTML = `<\/p>\n\n\n\n<p>&nbsp; &nbsp; &lt;strong&gt;${multipliers[i].name}&lt;\/strong&gt;&lt;br&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; Level: &lt;span id=&#8221;multiplierLevel${i}&#8221;&gt;0&lt;\/span&gt;&lt;br&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; Effect: x${Math.round(Math.pow(2, multipliers[i].level))}&lt;br&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; Cost: $&lt;span id=&#8221;multiplierCost${i}&#8221;&gt;100&lt;\/span&gt;&lt;br&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &lt;button id=&#8221;buyMultiplier${i}&#8221;&gt;Buy Level&lt;\/button&gt;<\/p>\n\n\n\n<p>&nbsp; `;<\/p>\n\n\n\n<p>&nbsp; container.appendChild(div);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>function updateUI() {<\/p>\n\n\n\n<p>&nbsp; document.getElementById(&#8216;score&#8217;).innerText = &#8216;Score: &#8216; + formatNumber(score);<\/p>\n\n\n\n<p>&nbsp; document.getElementById(&#8216;autoLevel&#8217;).innerText = autoLevel;<\/p>\n\n\n\n<p>&nbsp; document.getElementById(&#8216;autoProduction&#8217;).innerText = autoProduction;<\/p>\n\n\n\n<p>&nbsp; document.getElementById(&#8216;autoCost&#8217;).innerText = formatNumber(autoCost);<\/p>\n\n\n\n<p>&nbsp; \/\/ \u2b50 UPDATE UPGRADE BUTTON COST \u2b50<\/p>\n\n\n\n<p>&nbsp; document.getElementById(&#8216;autoNextCost&#8217;).innerText = formatNumber(autoCost);<\/p>\n\n\n\n<p>&nbsp; document.getElementById(&#8216;buyAuto&#8217;).innerText = &#8220;Upgrade Auto Clicker ($&#8221; + formatNumber(autoCost) + &#8220;)&#8221;;<\/p>\n\n\n\n<p>&nbsp; \/\/ Compute total click effect<\/p>\n\n\n\n<p>&nbsp; let totalMultiplierEffect = 1;<\/p>\n\n\n\n<p>&nbsp; for (let i=0; i&lt;4; i++) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; totalMultiplierEffect *= Math.pow(2, multipliers[i].level);<\/p>\n\n\n\n<p>&nbsp; }<\/p>\n\n\n\n<p>&nbsp; if (totalMultiplierEffect &gt; 1) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; document.getElementById(&#8216;clickBtn&#8217;).innerText = &#8216;Click me x&#8217; + formatNumber(totalMultiplierEffect);<\/p>\n\n\n\n<p>&nbsp; } else {<\/p>\n\n\n\n<p>&nbsp; &nbsp; document.getElementById(&#8216;clickBtn&#8217;).innerText = &#8216;Click me! (+1 point)&#8217;;<\/p>\n\n\n\n<p>&nbsp; }<\/p>\n\n\n\n<p>&nbsp; \/\/ Auto effect<\/p>\n\n\n\n<p>&nbsp; const autoEffect = Math.pow(2, autoLevel);<\/p>\n\n\n\n<p>&nbsp; let autoEffectText = &#8216;Auto effect x&#8217; + formatNumber(autoEffect);<\/p>\n\n\n\n<p>&nbsp; if (document.getElementById(&#8216;autoEffect&#8217;)) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; document.getElementById(&#8216;autoEffect&#8217;).innerText = autoEffectText;<\/p>\n\n\n\n<p>&nbsp; } else {<\/p>\n\n\n\n<p>&nbsp; &nbsp; const autoDiv = document.createElement(&#8216;div&#8217;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; autoDiv.id = &#8216;autoEffect&#8217;;<\/p>\n\n\n\n<p>&nbsp; &nbsp; autoDiv.style.color = &#8216;#fff&#8217;;<\/p>\n\n\n\n<p>&nbsp; &nbsp; autoDiv.innerText = autoEffectText;<\/p>\n\n\n\n<p>&nbsp; &nbsp; document.querySelector(&#8216;h3&#8217;).insertAdjacentElement(&#8216;afterend&#8217;, autoDiv);<\/p>\n\n\n\n<p>&nbsp; }<\/p>\n\n\n\n<p>&nbsp; \/\/ Update multipliers<\/p>\n\n\n\n<p>&nbsp; for (let i=0; i&lt;4; i++) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; document.getElementById(`multiplierLevel${i}`).innerText = multipliers[i].level;<\/p>\n\n\n\n<p>&nbsp; &nbsp; document.getElementById(`multiplierCost${i}`).innerText = formatNumber(50 * Math.pow(costMultiplier, multipliers[i].level));<\/p>\n\n\n\n<p>&nbsp; }<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>function saveGame() {<\/p>\n\n\n\n<p>&nbsp; localStorage.setItem(&#8216;clickerSave&#8217;, JSON.stringify({<\/p>\n\n\n\n<p>&nbsp; &nbsp; score,<\/p>\n\n\n\n<p>&nbsp; &nbsp; pointsPerClick,<\/p>\n\n\n\n<p>&nbsp; &nbsp; autoClickers,<\/p>\n\n\n\n<p>&nbsp; &nbsp; autoCost,<\/p>\n\n\n\n<p>&nbsp; &nbsp; autoLevel,<\/p>\n\n\n\n<p>&nbsp; &nbsp; autoProduction,<\/p>\n\n\n\n<p>&nbsp; &nbsp; multipliers<\/p>\n\n\n\n<p>&nbsp; }));<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>\/\/ Click handler<\/p>\n\n\n\n<p>document.getElementById(&#8216;clickBtn&#8217;).onclick = () =&gt; {<\/p>\n\n\n\n<p>&nbsp; let totalEffect = 1;<\/p>\n\n\n\n<p>&nbsp; for (let i=0; i&lt;4; i++) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; totalEffect *= Math.pow(2, multipliers[i].level);<\/p>\n\n\n\n<p>&nbsp; }<\/p>\n\n\n\n<p>&nbsp; if (totalEffect &lt; 1) totalEffect = 1;<\/p>\n\n\n\n<p>&nbsp; score += pointsPerClick * totalEffect;<\/p>\n\n\n\n<p>&nbsp; updateUI();<\/p>\n\n\n\n<p>&nbsp; saveGame();<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p>\/\/ Auto clicker<\/p>\n\n\n\n<p>function startAutoClicker() {<\/p>\n\n\n\n<p>&nbsp; if (autoInterval) clearInterval(autoInterval);<\/p>\n\n\n\n<p>&nbsp; autoInterval = setInterval(() =&gt; {<\/p>\n\n\n\n<p>&nbsp; &nbsp; if (autoClickers &gt; 0) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; const autoEffect = Math.pow(2, autoLevel);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; score += autoClickers * autoProduction * autoEffect;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; updateUI();<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; saveGame();<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; }, 1000);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>startAutoClicker();<\/p>\n\n\n\n<p>\/\/ \u2b50 BUY AUTO CLICKER (adds new auto clicker only) \u2b50<\/p>\n\n\n\n<p>document.getElementById(&#8216;autoBtn&#8217;).onclick = () =&gt; {<\/p>\n\n\n\n<p>&nbsp; if (score &gt;= autoCost) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; score -= autoCost;<\/p>\n\n\n\n<p>&nbsp; &nbsp; autoClickers++; \/\/ ONLY adds new auto clicker<\/p>\n\n\n\n<p>&nbsp; &nbsp; updateUI();<\/p>\n\n\n\n<p>&nbsp; &nbsp; saveGame();<\/p>\n\n\n\n<p>&nbsp; } else {<\/p>\n\n\n\n<p>&nbsp; &nbsp; alert(&#8216;Not enough points!&#8217;);<\/p>\n\n\n\n<p>&nbsp; }<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p>\/\/ \u2b50 UPGRADE AUTO CLICKER (increases level only) \u2b50<\/p>\n\n\n\n<p>document.getElementById(&#8216;buyAuto&#8217;).onclick = () =&gt; {<\/p>\n\n\n\n<p>&nbsp; if (score &gt;= autoCost) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; score -= autoCost;<\/p>\n\n\n\n<p>&nbsp; &nbsp; autoLevel++; \/\/ ONLY upgrade level<\/p>\n\n\n\n<p>&nbsp; &nbsp; autoCost = Math.floor(autoCost * costMultiplier);<\/p>\n\n\n\n<p>&nbsp; &nbsp; updateUI();<\/p>\n\n\n\n<p>&nbsp; &nbsp; saveGame();<\/p>\n\n\n\n<p>&nbsp; } else {<\/p>\n\n\n\n<p>&nbsp; &nbsp; alert(&#8216;Not enough points!&#8217;);<\/p>\n\n\n\n<p>&nbsp; }<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p>\/\/ Buy multipliers<\/p>\n\n\n\n<p>for (let i=0; i&lt;4; i++) {<\/p>\n\n\n\n<p>&nbsp; document.getElementById(`buyMultiplier${i}`).onclick = () =&gt; {<\/p>\n\n\n\n<p>&nbsp; &nbsp; if (multipliers[i].level &gt;= maxLevel) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; alert(&#8216;Max level reached!&#8217;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; return;<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; const cost = Math.floor(50 * Math.pow(costMultiplier, multipliers[i].level));<\/p>\n\n\n\n<p>&nbsp; &nbsp; if (score &gt;= cost) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; score -= cost;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; multipliers[i].level++;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; updateUI();<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; saveGame();<\/p>\n\n\n\n<p>&nbsp; &nbsp; } else {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; alert(&#8216;Not enough points!&#8217;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; };<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>\/\/ Reset<\/p>\n\n\n\n<p>document.getElementById(&#8216;reset&#8217;).onclick = () =&gt; {<\/p>\n\n\n\n<p>&nbsp; localStorage.removeItem(&#8216;clickerSave&#8217;);<\/p>\n\n\n\n<p>&nbsp; score = 0;<\/p>\n\n\n\n<p>&nbsp; autoClickers = 0;<\/p>\n\n\n\n<p>&nbsp; autoCost = 50;<\/p>\n\n\n\n<p>&nbsp; autoLevel = 0;<\/p>\n\n\n\n<p>&nbsp; autoProduction = 1;<\/p>\n\n\n\n<p>&nbsp; for (let i=0; i&lt;4; i++) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; multipliers[i].level = 0;<\/p>\n\n\n\n<p>&nbsp; }<\/p>\n\n\n\n<p>&nbsp; updateUI();<\/p>\n\n\n\n<p>&nbsp; startAutoClicker();<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p>\/\/ Background<\/p>\n\n\n\n<p>const canvas = document.getElementById(&#8216;gameCanvas&#8217;);<\/p>\n\n\n\n<p>const ctx = canvas.getContext(&#8216;2d&#8217;);<\/p>\n\n\n\n<p>function draw() {<\/p>\n\n\n\n<p>&nbsp; ctx.fillStyle = &#8216;#556B2F&#8217;;<\/p>\n\n\n\n<p>&nbsp; ctx.fillRect(0, 0, canvas.width, canvas.height);<\/p>\n\n\n\n<p>&nbsp; requestAnimationFrame(draw);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>draw();<\/p>\n\n\n\n<p>\/\/ Init<\/p>\n\n\n\n<p>updateUI();<\/p>\n\n\n\n<p>&lt;\/script&gt;<\/p>\n\n\n\n<p>&lt;\/body&gt;<\/p>\n\n\n\n<p>&lt;\/html&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This Free Friday, I worked on developing my clicker game in which players earn points by clicking a button. As players accumulate points, they can purchase an auto clicker that automatically generates clicks over time, increasing their point total even when they&#8217;re not actively playing. Additionally, players can buy multipliers that boost the effectiveness of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-json\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":2,"href":"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-json\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":38,"href":"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-json\/wp\/v2\/posts\/34\/revisions\/38"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-json\/wp\/v2\/categories?post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/h_yusko\/wp-json\/wp\/v2\/tags?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}