Pac-Man - No Ghosts on Maze
Nov 12, 2023
v.0
Play Pac-Man without ghosts on a maze and eat the dots to teleport on letters on the word 'ROCKER' in Old English font on the Darren world on the abdomen area and close to the belly button. Game Maze Letters Teleport Old English font ROCKER Abdomen Pacman DOTS Darren world

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

                <html>
<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">

<title>Pac-Man - No Ghosts on Maze</title>
<meta name="description" content="Play Pac-Man without ghosts on a maze and eat the dots to teleport on letters on the word 'ROCKER' in Old English font on the Darren world on the abdomen area and close to the belly button.">
<meta name="keywords" content="pac-man, game, maze, dots, teleport, letters, ROCKER, Old English font, Darren world, abdomen, belly button">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

<script type="text/javascript">
try {
// App Javascript Goes Here. Place your entire script content inside the try block for error handling.

// This will run when the DOM is ready.
document.addEventListener("DOMContentLoaded", function() {
// Constants
const mazeWidth = 600; // Width of the maze
const mazeHeight = 400; // Height of the maze
const dotSize = 10; // Size of each dot
const pacmanSize = 20; // Size of Pac-Man
const pacmanSpeed = 5; // Speed of Pac-Man
const letterMazes = ['R', 'O', 'C', 'K', 'E', 'R', 'ॐ']; // List of letter-shaped mazes

// Variables
let mazeIndex = 0; // Index of the current maze
let score = 0; // Score

// Set up the maze
const maze = document.getElementById('maze');
maze.style.width = mazeWidth + 'px';
maze.style.height = mazeHeight + 'px';

// Set up Pac-Man
const pacman = document.getElementById('pacman');
pacman.style.width = pacmanSize + 'px';
pacman.style.height = pacmanSize + 'px';
pacman.style.left = (mazeWidth / 2 - pacmanSize / 2) + 'px';
pacman.style.top = (mazeHeight / 2 - pacmanSize / 2) + 'px';

// Set up the score HUD
const scoreHUD = document.getElementById('score-hud');

// Function to move Pac-Man
function movePacman(direction) {
let x = parseInt(pacman.style.left);
let y = parseInt(pacman.style.top);

switch(direction) {
case 'up':
y -= pacmanSpeed;
break;
case 'down':
y += pacmanSpeed;
break;
case 'left':
x -= pacmanSpeed;
break;
case 'right':
x += pacmanSpeed;
break;
}

// Check if Pac-Man is inside the maze
if (x >= 0 && x <= mazeWidth - pacmanSize && y >= 0 && y <= mazeHeight - pacmanSize) {
pacman.style.left = x + 'px';
pacman.style.top = y + 'px';
}

// Check if Pac-Man has reached a dot
const dots = document.getElementsByClassName('dot');
for (let i = 0; i < dots.length; i++) {
const dot = dots[i];

if (isColliding(pacman, dot)) {
dot.remove();
score += 10;
scoreHUD.innerText = 'Score: ' + score;

// Check if all dots have been eaten
if (dots.length === 1) {
// Check if it's the last level
if (mazeIndex === letterMazes.length - 1) {
alert('Congratulations! You completed all levels!');
} else {
alert('Level completed!');
maze.innerHTML = '';
mazeIndex++;
createMaze(mazeWidth, mazeHeight, dotSize, pacmanSize, pacmanSpeed, letterMazes[mazeIndex]);
}
}
}
}
}

// Function to check collision between two elements
function isColliding(element1, element2) {
const rect1 = element1.getBoundingClientRect();
const rect2 = element2.getBoundingClientRect();

return !(
rect1.top > rect2.bottom ||
rect1.right < rect2.left ||
rect1.bottom < rect2.top ||
rect1.left > rect2.right
);
}

// Function to create a maze
function createMaze(width, height, dotSize, pacmanSize, pacmanSpeed, letter) {
// Create the dots
for (let x = dotSize; x < width; x += dotSize) {
for (let y = dotSize; y < height; y += dotSize) {
const dot = document.createElement('div');
dot.className = 'dot';
dot.style.width = dotSize + 'px';
dot.style.height = dotSize + 'px';
dot.style.left = x + 'px';
dot.style.top = y + 'px';
maze.appendChild(dot);
}
}

// Set up the letter maze
const letterMaze = document.createElement('div');
letterMaze.className = 'letter-maze';
letterMaze.innerText = letter;
maze.appendChild(letterMaze);

// Set up the bonus maze
if (letter === 'ॐ') {
const bonusMaze = document.createElement('div');
bonusMaze.className = 'bonus-maze';
bonusMaze.innerText = 'ॐ';
maze.appendChild(bonusMaze);
}

// Set up keyboard controls
document.addEventListener('keydown', function(event) {
switch(event.key) {
case 'ArrowUp':
movePacman('up');
break;
case 'ArrowDown':
movePacman('down');
break;
case 'ArrowLeft':
movePacman('left');
break;
case 'ArrowRight':
movePacman('right');
break;
}
});
}

// Create the initial maze
createMaze(mazeWidth, mazeHeight, dotSize, pacmanSize, pacmanSpeed, letterMazes[mazeIndex]);
});

} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>

<style>
/* App CSS Goes Here */
#maze {
position: relative;
background-color: black;
}

#pacman {
position: absolute;
background-color: yellow;
border-radius: 50%;
}

.dot {
position: absolute;
background-color: white;
border-radius: 50%;
}

.letter-maze, .bonus-maze {
position: absolute;
color: white;
font-family: 'Old English Text MT', serif;
font-size: 100px;
}

.letter-maze {
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}

.bonus-maze {
left: 20px;
top: 20px;
}

#score-hud {
margin-top: 20px;
font-family: 'Old English Text MT', serif;
font-size: 24px;
color: white;
}
</style>

<link href="https://fonts.googleapis.com/css?family=Old+English+Text+MT" rel="stylesheet">

<link rel="canonical" href="https://calculator.tools/app/pac-man-no-ghosts-on-maze-674/">
<meta charset="utf-8">

</head>
<body>
<div id="main-container" class="container">
<div id="maze"></div>
<div id="pacman"></div>
<div id="score-hud">Score: 0</div>
</div>
<script type="text/javascript"> var localStoragePrefix = "ct-674"; 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.