For my midterm project, I want to do a cute little game where the user gets to play around on the beach as a cat. Initially, I wanted the game to be about a turtle that lays eggs on the beach because I go on turtle nest patrols on Saadiyat as a volunteer and it is one of the most exciting activities I get to do in spring. Sadly, it was impossible to find a sprite sheet and terrain elements of the aesthetic style I am going for, and I had to swap the main character from a turtle to a cat. The game is essentially a cat simulator on the beach, where the player gets to feed, play with the cat and explore the beach.
I always find picking the overall theme of the project to be the most difficult part, which is why I spent a lot of time looking for the fitting terrain, beach elements, and sprite. At the moment I am using the following images to build the game terrain:
Implementation
At the moment, I have elements of the starting screen where the user gets to pick what cat they want to be: when a mouse hovers over a certain cat it moves up and down. As I mentioned earlier, the most time-consuming part of this project is getting these images and cropping them in a way that I can use them in arrays. For example, to get these cats on the screen () I had to crop the big picture into smaller parts that are of uniform size and spaced out evenly. Once I am done with preparing the images, coding the program should not be a challenge.
Future Plans
Add beach elements like palm trees, ponds, seashells, etc that the cat can interact with
Add cat “status” of its needs that need to be fulfilled in the game (if not fulfilled the cat dies 🙁 )
These are the basic required functionalities of the game, however, there is a lot more that I wish to implement like making the game multiplayer, adding new characters (birds) that I have the resources for in terms of spritesheets. Whether they will come to life or not will depend on the time restrictions, but I am very excited to see how this project will turn out in the end!
As part of my Mid term project, the idea is to create a game that is similar to the traditional ‘space-ship’ games, combined with the ‘infinite-runner’ game ideology. This would essentially be a canvas, where a rocket starts from the bottom, has freedom to move around, with the background moving, depicting a running environment. The objective would be for the rocket to dodge some meteors falling from the sky, and also to fuel up with cans that become available in intervals.
The graphical objects that I gathered so far are:
Code Structure & Progress
The code structure is intended to be Object Oriented and Modular. As of right now, I have a canvas with a background that repeats itself smoothly and a Rocket that moves around the canvas, wraps around the sides.
The Asteroids will be made to ‘spawn’ with time, and then as soon as they exit the screen, they will be respawned from the top end of the screen again.
Complexity
There will be more clarity of the complexity as I start running into issues, however, the primary objective of mine is to provide controls to the rocket such that it is rotatable. I will have to use mathematical calculations with the ‘right’ and ‘left’ keys to ensure the rocket does not flip its image to the right and left directions, instead it bends at an angle as the right and left keys are pressed. This is a functionality that I shall experiment and figure out!
Another functionality that I envision to add is local storage on the Chrome Browser to keep track of a ‘score’, and record the highest score. Only the highest score shall be saved per device.
Especially the balloon-boy mini-game or Chica mini-game where essentially as the main character, you’re in a platform style game and you’re supposed to go around collecting balloons to give to the children throughout the game. I found it a pretty simple concept but very fun to play around with:
I obviously wanted my own design of the game but I had trouble thinking of what to do. But, I was watching one of my favourite animes One Piece and I thought why not just make a game about that! It’s a pretty cool idea and it’s pretty motivational for me so I went along with it!
My Game Idea:
The game idea is pretty cool. Essentially the main character of the series is a guy called Luffy, and he is known for always being hungry and eating everything he can possibly find. So, I decided to make a similar platform style game where Luffy would jump around eating as much food as possible.
To make it into a game, I thought of implementing a depleting hunger bar, and the goal is to keep feeding Luffy by jumping around and eating food before that hunger bar runs out and the only way to refill that hunger bar is to eat food. If you manage to satisfy Luffy’s hunger bar before time runs out, you win! Else you lose!
Progress:
With regards to my process, i’ve so far, made the main menu screen. This main menu screen has some music playing in the background, I added a slider so the user can control the volume. I added an instructions tab so the user knows how to play. I also added a difficulty system, where the user can select between Easy, Medium and Hard mode. The idea is, the greater the difficulty, the faster Luffy’s Hunger bar depletes, hence the more challenging it gets to satisfy Luffy’s hunger.
I’ve also set the stage for the platforms of the game and i’ve added an animation for the hunger bar depletion when the game starts. If the hunger bar reaches 0, for now it just says “Game Over”:
Game:
Things still left to do:
I have to create the food items and their specific data (this includes their spawn point, spawn rate and food value)
I have to animate Luffy’s movements (using a sprite sheet i’ve found on the internet)
I have to work on collision detection with Luffy and the Food objects and the Platform objects.
I have to ensure that when a collision is detected between Luffy and Food, it should refill the Hunger Bar
Add a time countdown
Create an ending screen (depending on whether the user wins/loses)
Allow the user to restart or go back to the Main Menu.
Terrifying parts of the code:
In my opinion, I think the most terrifying bit is going to be two things, animating Luffy’s movements, being both left and right and especially the jumping animation. The issue with this is, if you press both the LEFT and UP arrow keys together, they don’t move the object diagonally because it registers as one key pressed at a time, so to handle smooth movement is going to be tricky. I’m thinking to avoid this I might have to ensure the platforms are close enough for the user to maneuver across the game.
Also animating Luffy’s jump is going to be extremely tricky. For this, I am thinking of creating a sort of gravity variable, which will allow Luffy to move up a maximum distance when pressed the UP Arrow key and then after that, he would move down in the opposite direction. Still need to do some thinking for that.
Finally, another tricky thing would be collision detection. I’m wondering how to ensure that Luffy can stand on the platforms. For now, i’ve set up a class for Platforms and a class for Luffy and if their x and y coordinates are the same, then Luffy can stand on the platforms. Still need to do some more thinking of that.
Overall:
Overall, I feel like this can be a really cool game. The easy bit is kinda done but the challenging bits are here and I’ll work hard to ensure the game is great!
For the midterm, I am planning to create a game in which a character falls and lands on different platforms that keep emerging from the bottom. The main goal is to stay on the platforms that are within the canvas dimensions for as long as possible and the time plus added components decide a player’s score for the round. It is a score based game and going above or below the top and bottom of the canvas respectively ends the game.
I was intimidated by the code where I had to keep the ball (Player) on the platforms but by making separate classes of ball and platforms I was able to manage that as well. I still need to add more conditions to make the movement and fall of the ball smoother.
Further Work
I have only been able to get done with the basic idea of the game and still need to add the following features:
Cause the ball to move as long as the key is pressed
Make the platforms appear in a more organized sequence
Fix the error where the ball seems to be passing through the platforms
Set conditions on how the game is lost (by touching the top of the canvas)
For the midterm project I decided to make a galaga game. While my version of galaga would be a little different from the original galaga game, I will try my best to keep the essence of the galaga game while adding something more from what we learned in class.
Code:
Unfortunately I was sick over the weekend and I couldn’t do much with the project so so far my progress is the basic game mechanism where you can start the game by pressing the space bar and move the galaga ship using left and right arrow keys and shoot bullets using the up arrow key. For each enemy killed you get 100 scores and if you eliminate all the enemies, you advance a level. So far the mechanism is not yet completely finished and I hope to add enemy movement manipulation and enemy shooting bullets as well with a more concrete stage level progression mechanism and showing of it.
I also need to get better polished images and add music but again I couldn’t because I was/am sick… I hope to do the polishing as soon as I get better.
Chellange:
The challenege in this project so far was the enemy movement maniulation and the the stage progression which I am still working on it now. Another difficulty I found was reseting the game after the end of the game which I have encountered bugs that I’m not sure why its happening. I plan to tackle all this as soon as I get better.
Pong is a classic two-player game that simulates table tennis. The players use paddles to hit a ball back and forth across the screen. The objective of the game is to score points by getting the ball past the opponent’s paddle.
Project Concept and Design
The goal of this project is to create a basic Pong game that can be played by two players. The game will have two paddles, one for each player, and a ball that bounces around the screen. The players will use their paddles to hit the ball back and forth, with the objective of getting the ball past the opponent’s paddle. The game will have a scoring system that keeps track of each player’s score, and the first player to reach a certain number of points (e.g., 10) will be declared the winner. The game will also have sound effects to enhance the gameplay experience.
The Most Frightening Part (Implemented)
Initially, the most frightening part of this project was not knowing how the game would pan out with the collisions and movement of the ball and paddles. It was essential to get that part of the game right to ensure that the game could be implemented. To reduce this risk, I decided not to leave the implementation of the game to the end but started implementing the project slowly with one feature at a time. This approach allowed me to test each feature as I implemented it and make adjustments as needed to ensure that the game was working as expected. There sure are more improvements that can be added to this system, but a decent amount of work has already been done.
The paddles now move with the UP and DOWN arrows, and the “W” and “S” keys.
Future Enhancements
Adding a picture background in the play area.
Adding an instruction screen(with text) in the beginning.
Adding sound effects.
Adding a game termination check and a “Game Over” screen.
Adding a restart button in the “Game Over” screen that restarts the game.
For my midterm project, I want to create a philosophical experience disguised as a dungeon crawler game. I am taking inspiration from The Legend of Zelda, to the point that I plan to use their assets. The experience will consist of two parts:
Start of the game, which looks like something you’d find in old retro games from the 90s. You’re shown that you can move around and attack, and there are monsters aroud, so you conclude that you should attack and kill them.
Eventually, you have to be killed by the monsters (a scripted death). Then the tone (and possibly artwork, art style) completely changes. You’re presented with a ‘path’ to the afterlive and by walking the path you have to confront all the lives you took. I essentially want to subvert the expectations of what it means to be a character in a retro video game killing other live in the game.
From the start, I realized that one of the most difficult parts would be creating a good and efficient animation system, where I would be able to animate entities in the game using sprites/spritesheets. Therefore this is the first major thing I implemented. This actually consisted of two major things: 1) a mechanism for loading assets (images, sounds, etc.), and 2) a way to animate game entities.
Loading assets
I wanted to make my mechanism for loading assets easily configurable, so that I could easily change and configure images, spritesheets, and animations without going through several places in the code. I came up with the concept of having a file, such as assets.txt, which contains all my assets. Each line in the file would look like one of the following:
(Note: I plan to add a way to define sounds too. And I will explain how animations work in a bit.)
I am essentially giving a name to all assets so I can reuse and easily find them later when creating the game entities. At the same place I am configuring them.
In practice, the concept of having a file that tells you which other files to load (i.e. images) seems difficult to implement in p5, even using the preload function. Therefore I had to define the ‘assets’ file as a list of strings, which is functionally the same, although looks a bit uglier. Still, it accomplished what I wanted.
Moving on. I created an Assets class which handles the loading of all asset files and creating all animations, and I do these things in the preload function of p5. In the assets class, I have two maps, which I populate using information from the file:
textureName (a string) –> p5.Image (the thing created when using loadImage)
animationName (a string) –> Animation (a class I created and will describe soon)
When loading assets, I had to make sure that all textures are loaded before all animations, because every animation object has a texture which is passed to its constructor and whose properties are used immediately. To accomplish this order of loading, I had to use callback functions, but everything turned out alright in the end.
Animations
I created an Animation class which contains its name, its spritesheet (texture, i.e. a p5.Image), how many frames the animation should have before ending or repeating, and its speed (how often it should update). For example, a texture I used is the following:
Then I create an animation that uses this texture (i.e. this texture is the animation’s spritesheet). The animation has a frameCount of 2 and a speed of 15, which means that it should change its state every 15 frames.
To draw animations I used p5’s feature to only draw sections of its spritesheet. I also store at which ‘cell’ I currently am in the animation in order to speed things up a bit.
Switching between animations based on state
I wanted my player character to use a different animation depending on whether they are standing, running, attacking, etc. To implement this I also store a state component in the player, which is just a string with one of these values: “stand”, “run”, or “attack”. I also store the direction the player is facing along each axis, which changes when they move. For example, if they are currently facing down, the facing would be a vector (0, 1). Facing up: (0, -1). Facing right: (1, 0). Facing left: (-1, 0). Using this, every frame, I update the animation to display.
The sketch
Future plans
With the asset and animation systems done, it is now very easy to add and use new textures and animations. I can now focus on creating the level, adding sounds/music, and most importantly creating the second component of the game.
My concept this week is to continue building on the “SURVIVE” game I made in week 3. It is an interactive video game in which the player is a triangle located at the cursor and the objective is to avoid incoming projectiles RGB colored projectiles.I have removed the “MISSION ACCOMPLISHED” page as I have opted to make the game Tetris style. That means the game is an endless mode in which the goal is to survive for as long as possible and get a highscore. Instead of counting down the timer counts up and speed of the projectiles get faster based off of the time elapsed. I have also added different menus to help navigate the game. This includes a main menu and game over menu.
Embedded:
Code:
function resetGame() {
rain = [];
range = 400;
size = 30;
health = 3;
ctr = 0;
count = 0;
lost = 0;
win = 0;
speedinc = 0;
starttime = 2;
timer = 0;
for (let i = 0; i < 120; i++) {
rain.push(new raindrop());
}
}
The main change between this new iteration is the ability to reset the game back to its original state without rerunning theb sketch. This is made possible using the resetGame() function. The purpose of this function is to reinitialize all the games attributes back to its baseline.
Another aspect is navigating between the different menus. The structure that this is done with determines how clean or messy the code would be. I opted to have each menu in a different if statement which checks the current “level”. There are 4 different levels currently. These consist of the game itself, main menu, game over screen, and high scores. Using this structure, the program is only able to access which is made available to the current level variable. This makes developing features in the game much simpler and easier.
Challenges:
I had an issue where when I return to main menu after the Game over screen the buttons would not work, the issue was fixed by temporarily commenting out the level 3 line as it has not been implemented which caused the program to completely halt as it entered level 3 (highscores).
Future Improvements:
The project is halfway completed. The next features to be developed: Add a points system which increases based on the timer, Add a background image and sound effects, Add various power ups and interactable items, complete the Highscore page and make it so that you can enter your name and score into the leaderboard, and finally to add different fonts and sprites. My hope is that the game ends up being a fun and engaging game in which friends can compete in achieving highscores.
For my midterm project, I decided to make a game based on one of my favorite fables, The Boy Who Cried Wolf! The story goes that the boy, a shepherd, gave a false alarm to a village about a wolf coming to attack their sheep. Having done it two times, the third time, when a wolf was actually coming, the villagers did not believe him, leaving the sheep dead. There is a valuable lesson in this story, but as a child, I always wished they had saved the sheep. Why not believe the third time, you know, just in case? So, I decided to create a game in which a shepherd needs to collect his sheep into a pen before the wolf arrives to eat them.
Progress
For now, I have created the sheep and shepherd graphics and shapes which are underneath the images. The shepherd moves the sheep as he gets close to them and the sheep move around each other if they get too close. What is left is the sheep pen and the interactions concerning it. As for the graphics that are left, I intend on making the wolf, start and end screens, all pixelated as that is what I aim for the game to look like. I have also created the tree graphics which I will place around the screen.
Challenge
The most challenging part as of now is the sheep and pen interactions. Since the sheep move by 15 pixels as the shepherd approaches, it will take some thinking and logic to stop them from moving through the fence. I have experimented a bit and some solutions worked to a certain extent while others failed miserably. Since that is the last part of the game that needs to be implemented, I will put in some work to make it as smooth as possible. I have imported a library that makes shape interactions easier to handle.
The game might not be extremely complex at its core, but I have limited myself to only one or two libraries. The rest I wish to finish using pure JS. If possible, I also wish to create a second phase of the game where the shepherd and the wolf fight if the sheep are placed in the pen on time. If I have time left, I will try and make this possible or simplify the fight in order to incorporate it into the final version.
For the midterm, I decided to recreate one of my favorite childhood games, Doodle Jump. The user will be able to play the game using either WASD or arrows. The goal of the game is to score as many points as possible. The higher you get, the harder it will be to survive.
As you can see on the sketch, the game already has the intro page, the user selects which doodler he wants to use; the main page, the game itself with platforms, boosters, and hazards; and the game over the page, a meme about how you lost.
The hardest part of this project is the animation of a doodler. There are so many cases such as trampoline, jetpack, hat, shooting and etc. For each one of them, there is a different doodler. Hence, I had to upload more than 20 images and use each one of them accordingly. I already implemented this part, which makes my life much easier.
However, there are a few things that do not work right now. The sounds get collapsed. Only one platform is shown. The Jetpack is shown instead of the appropriate booster. These are the bugs I have to fix before spring break.