Mario's Locker Room Adventure
Nov 17, 2023
v.0
Help Mario grab all the coins in the grand locker room! Game Interactive Adventure Mario Coins

Versions  

Bugs  
None!

Get This App On Your Website

1. Copy the code above with the iframe and link.
2. Paste the code into your website.
3. Resize the iframe to fit your website.

Javascript, HTML, CSS Code

                
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript"> window.addEventListener('error', function(event) { var message = JSON.parse(JSON.stringify(event.message)); var source = event.filename; var lineno = event.lineno; var colno = event.colno; var error = event.error; window.parent.postMessage({ type: 'iframeError', details: { message: message, source: source, lineno: lineno, colno: colno, error: error ? error.stack : '' } }, '*'); }); window.addEventListener('unhandledrejection', function(event) { window.parent.postMessage({ type: 'iframePromiseRejection', details: { reason: event.reason } }, '*'); }); </script>

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mario's Locker Room Adventure</title>
<meta name="description" content="Help Mario grab all the coins in the grand locker room!">
<meta name="keywords" content="Mario, Adventure, Coins, Game, Interactive">

<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">

<style>
body, html {
height: 100%;
margin: 0;
font-family: 'Press Start 2P', cursive;
background: linear-gradient(#5ee7df, #b490ca);
}
#game-container {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}
.mario {
width: 50px;
height: 80px;
background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/1171930/mario.png') left center;
background-size: 150%;
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
}
.coin {
width: 30px;
height: 30px;
background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/1171930/coin_sprite.png') left center;
background-size: cover;
position: absolute;
animation: spin 1s steps(10) infinite;
}
.coin.collected {
visibility: hidden;
}
.locker {
position: absolute;
width: 60px;
height: 100px;
background: #f4d35e;
border: 3px solid #ee964b;
border-radius: 5px;
text-align: center;
padding-top: 70px;
box-sizing: border-box;
color: white;
}
.floor {
position: absolute;
width: 100%;
height: 20px;
background: #333;
bottom: 0;
}
.ladder {
position: absolute;
width: 40px;
height: calc(100% - 20px);
background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/1171930/ladder_sprite.png') center center;
background-size: cover;
left: 50%;
transform: translateX(-50%);
}
@keyframes spin {
100% { background-position: -300px; }
}
</style>

<link rel="canonical" href="https://calculator.tools/app/marios-locker-room-adventure-733/">
<meta charset="utf-8">

</head>
<body>
<div id="game-container">
<div class="mario" id="mario"></div>
<div class="floor"></div>
<div class="locker" style="left: 36%;">36●8-B <div class="coin" id="coin1" style="bottom: 110px;"></div></div>
<div class="locker" style="left: 101.8%;">1018●2-E <div class="coin" id="coin2" style="bottom: 200px;"></div></div>
<div class="locker" style="left: 201.9%;">2019●3-F <div class="coin" id="coin3" style="bottom: 110px;"></div></div>
<div class="ladder"></div>
</div>

<script>
const mario = document.getElementById('mario');
const coin1 = document.getElementById('coin1');
const coin2 = document.getElementById('coin2');
const coin3 = document.getElementById('coin3');
let marioX = 50;
let marioY = 20;
let marioJumping = false;
let marioDirection = 'right';

document.addEventListener('keydown', (e) => {
if (e.key === 'ArrowLeft') {
marioDirection = 'left';
marioX -= 5;
mario.style.backgroundPositionY = 'bottom';
mario.style.transform = 'translateX(-50%) scaleX(-1)';
} else if (e.key === 'ArrowRight') {
marioDirection = 'right';
marioX += 5;
mario.style.backgroundPositionY = 'bottom';
mario.style.transform = 'translateX(-50%) scaleX(1)';
} else if (e.key === 'ArrowUp' && !marioJumping) {
marioJumping = true;
marioY = 100;
setTimeout(() => {
marioY = 20;
marioJumping = false;
}, 500);
} else if (e.key === 'ArrowDown') {
// Crouching action can be added here if desired
}

mario.style.left = marioX + '%';
mario.style.bottom = marioY + 'px';

collectCoin(marioX, marioY);
});

function collectCoin(marioX, marioY) {
const marioCenterX = marioX + 25;
const marioCenterY = marioY + 40;

const coin1CenterX = 36;
const coin1CenterY = 140;
const coin1Distance = Math.sqrt(Math.pow(marioCenterX - coin1CenterX, 2) + Math.pow(marioCenterY - coin1CenterY, 2));

const coin2CenterX = 101.8;
const coin2CenterY = 230;
const coin2Distance = Math.sqrt(Math.pow(marioCenterX - coin2CenterX, 2) + Math.pow(marioCenterY - coin2CenterY, 2));

const coin3CenterX = 201.9;
const coin3CenterY = 140;
const coin3Distance = Math.sqrt(Math.pow(marioCenterX - coin3CenterX, 2) + Math.pow(marioCenterY - coin3CenterY, 2));

if (coin1Distance <= 30 && !marioJumping) {
coin1.classList.add('collected');
}
if (coin2Distance <= 30 && marioJumping) {
coin2.classList.add('collected');
}
if (coin3Distance <= 30 && !marioJumping) {
coin3.classList.add('collected');
}
}
</script>
<script type="text/javascript"> var localStoragePrefix = "ct-733"; var lastSave = 0; function saveLocal(data) { if (Date.now() - lastSave < 1000) { return; } let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict"; cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString(); document.cookie = cookie; lastSave = Date.now(); } function loadLocal() { var cookiePrefix = localStoragePrefix + "="; var cookieStart = document.cookie.indexOf(cookiePrefix); if (cookieStart > -1) { let cookieEnd = document.cookie.indexOf(";", cookieStart); if (cookieEnd == -1) { cookieEnd = document.cookie.length; } var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd); return JSON.parse(cookieData); } } </script>
<script type="text/javascript"> window.addEventListener('load', function() { var observer = new MutationObserver(function() { window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); observer.observe(document.body, {attributes: true, childList: true, subtree: true}); window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); </script>
</body>
</html>

NEW APPS

These are apps made by the community!

FAQ

What is Calculator Tools?

Calculator Tools allows you to instantly create and generate any simple one page web app for free and immediately have it online to use and share. This means anything! Mini apps, calculators, trackers, tools, games, puzzles, screensavers... anything you can think of that the AI can handle.

The AI uses Javacript, HTML, and CSS programming to code your app up in moments. This currently uses GPT-4 the latest and most powerful version of the OpenAI GPT language model.

What Do You Mean Make An App?

Have you ever just wanted a simple app but didn't want to learn programming or pay someone to make it for you? Calculator Tools is the solution! Just type in your prompt and the AI will generate a simple app for you in seconds. You can then customize it to your liking and share it with your friends.

AI has become so powerful it is that simple these days.

Does This Use ChatGPT?

It uses GPT-4 which is the most powerful model for ChatGPT.

Calculator Tools does not remember things from prompt to prompt, each image is a unique image that does not reference any of the images or prompts previously supplied.