Concept
A game, where the ghost is being chased, while not done before is not impossible. Here, I present you my midterm project, which is named Ghost-Me! and is funnily enough a ghost that is me (or in this case the user-you). I believe the backstory is just as important as the game itself, so for this project I chose the topic of a horror parody game. The main character (the ghost) is being chased by his mom. You may ask yourself “But why?” and here is the story behind it: Your clothes are piling up, you have not folded your laundry for weeks now. Mom is extremely mad and is chasing you until you pick up some of your laundry. You are not really a ghost, but you have a sheet over your head, because all of your other clothes are not tidied up. Now, run!
Full screen option: https://editor.p5js.org/ags9971/sketches/qYL1Axylu
Game features
You use the arrows to move in different directions while your mother is chasing you. You have to pick up 10 particles of clothing from the pile, but be cautious-they blend in really good (hint:orange t-shirt and jeans). If you are caught before that you lose. If you get them you win!
Game Design
At first the user reads the description, then acts on it and presses the start button, which activates the game. From then on the option are you either lose or you win, so there are 4 stages of the game possible.
Inspired by “The Scream”, Edvard Munch
The game itself with the piles of clothes in the background, clothes ccounter in upper right corner
As I previously mentioned, I wanted to draw every part of the game by myself and am glad that I succeeded in this. I used ProCreate to draw everything.
The game has a “scary” sound running in the background, as well as a lose and a win sound that play depending on the situation.
Problems I ran into
I had trouble with figuring out how to move mom to the direction of the ghost. After trying a variety of options, I ended up choosing a combination of two.
//directions and speed of the mom
if (mumX < x) {
mumX = mumX + mumSpeed;
mumDirection = 2;
}
if (mumX > x) {
mumX = mumX - mumSpeed;
mumDirection = 1;
}
if (mumY < y) {
mumY = mumY + mumSpeed;
mumDirection = 0;
}
if (mumY > y) {
mumY = mumY - mumSpeed;
mumDirection = 3;
}
let mumRow = direction;
if (direction === 1) {
mumRow = 2;
}
if (direction === 2) {
mumRow = 1;
}
From the first part direction 0 and 3 override 1 and 2 or in other words mom only either walks up or down. Even though it looks scary it is not what I was going for. Later I added the second part, which matches the ghost’s direction. There is another issue and if it was any other case I would not use it, but for the purpose of an exaggerated funny not-so-horror game, it works. The issue is simply the fact that when the ghost turns to mom while being chased she turns her back and it looks like she is moonwalking.
What I am particularly proud of
fill(0);
textAlign(LEFT, TOP);
textSize(25);
text("Clothes:" + score + " - 10", 30, 30);
//picking up clothes
if (dist(x, y, clothX, clothY) < 50) {
score = score + 1;
newCloth();
if (score >= 10) {
gameState = "win";
if (sound3 && sound3.isPlaying()) sound3.stop();
if (win && !win.isPlaying()) win.play();
} else {
if (sound2 && !sound2.isPlaying()) {
sound2.play();
}
}
}
// when caught by mom
if (dist(x, y, mumX, mumY) < 50) {
gameState = "stop";
if (sound3 && sound3.isPlaying()) sound3.stop();
if (lose && !lose.isPlaying()) lose.play();
}
}
I am proud of this code, because I used dist() for the first times here when the ghost is picking up clothes and when the mom catches the ghost.
Additionally, I am proud of my drawings and idea.
Future improvements
If I am to do this all over again, I would try to fix the directions problem and would add more levels or game states.
AI declaration
AI was used for debugging and as previously mentioned in my progress post for making sprite sheets out of my files.
References
https://p5js.org/reference/p5/dist/
