"Love": loadImage("icon 1 .png"),
"Money": loadImage("icon 2 .png"),
"Health": loadImage("icon 3 .png"),
"Luxury": loadImage("icon 4 .png"),
"Happiness": loadImage("icon 5 .png"),
"Success": loadImage("icon 6 .png"),
bgImage = loadImage("background.jpg");
function drawStartScreen() {
textAlign(CENTER, CENTER);
text("Manifestation Shopping Game", width / 2, height / 2 - 20);
text("Click 'Start' to begin", width / 2, height / 2 + 20);
rect(width / 2 - 50, height / 2 + 50, 100, 40);
text("Start", width / 2, height / 2 + 70);
function drawGameOverScreen() {
textAlign(CENTER, CENTER);
text("Game Over!", width / 2, height / 2 - 20);
text("Click anywhere to restart", width / 2, height / 2 + 20);
function drawWinScreen() {
textAlign(CENTER, CENTER);
text("Congratulations! You Won!", width / 2, height / 2 - 40);
text("Click anywhere to restart", width / 2, height / 2);
for (let i = 0; i < 100; i++) {
fill(random(255), random(255), random(255));
ellipse(random(width), random(height), random(5, 15));
function drawGameScreen() {
text("Welcome to the Manifestation Shopping Game!", 20, 30);
text("Shop without exceeding 10 points!", 20, 50);
text(`Time Left: ${timer}s`, width - 150, 30);
for (let i = 0; i < itemList.length; i++) {
if (itemImages[itemList[i].name]) {
image(itemImages[itemList[i].name], 20, y - 40, 70, 70);
if (i >= itemList.length - 3) {
text(`${itemList[i].name}: ${itemList[i].points} points`, 200, y);
text(`${itemList[i].name}: ${itemList[i].points} points`, 190, y );
rect(600, y - 30, 140, 50);
textAlign(CENTER, CENTER);
text("Add to Cart", 670, y);
for (let item of selectedItems) {
if (itemImages[item.name]) {
image(itemImages[item.name], xOffset, 510, 50, 50);
text(`Total Points: ${totalPoints}`, 400, 550);
function mousePressed() {
mouseX > width / 2 - 50 &&
mouseX < width / 2 + 50 &&
mouseY > height / 2 + 50 &&
if (gameOver || timer <= 0) {
for (let i = 0; i < itemList.length; i++) {
if (mouseX > 600 && mouseX < 740 && mouseY > y - 30 && mouseY < y + 20) {
if (totalPoints + itemList[i].points <= 10) {
selectedItems.push(itemList[i]);
totalPoints += itemList[i].points;
clearInterval(timerInterval);
{ name: "Love", points: Math.floor(random(5, 8)) },
{ name: "Money", points: Math.floor(random(7, 10)) },
{ name: "Health", points: Math.floor(random(4, 6)) },
{ name: "Luxury", points: Math.floor(random(3, 5)) },
{ name: "Happiness", points: Math.floor(random(4, 7)) },
{ name: "Success", points: Math.floor(random(6, 9)) },
itemList = shuffle(possibleItems).slice(0, 4);
timerInterval = setInterval(() => {
clearInterval(timerInterval);