For my midterm, I wanted to make some form of pixel art-type monster fighting game in a 2D world. My inspiration for this comes from games like pokemon that I played on my Gameboy as well as newer Nintendo Switch games like Towerfall. I drew up a sketch of what I wanted my game to look like but I was open to making changes so that the gameplay is smooth.
I know this is going to be challenging and quite time-consuming but I want to see how far I can push myself and create a fun game that I and others can enjoy.
I was thinking of making my own pixel art assets but soon found that I do not have the skills nor the time to learn the skills to make them myself right now. I would like to explore this further in the future but for now, I used assets from Itch.io. I found some player and object and skeleton sprite sheets that are free for non-commercial use. I got sounds from Freesound.org and mixkit.co for all the game feedback sounds and the soundtrack from here. P.S the player dying sound was recorded by me (Professor Aaron thought it would be a nice touch and I agree)
I found this Desdemona font that matched the look I was going for so I used this custom font in my game.
I was hoping to find a stage online that I could use for my game but I didn’t really find anything that I liked. I did some googling and found something called tilesets which is similar to sprite sheets but for building 2D levels. I use this dungeon tileset that was free to download along with Tiled to create my own basic level.
I flipped the sprite sheet to obtain movement in the left and right directions with Preview on my laptop. Using the boilerplate code from class that Professor Aaron provided, I was able to get my player up and running.
This was a bit tricky as I wanted all the attack sprites to loop with a mouse click. I couldn’t figure it out at first because I was using a while loop which made my program freeze. With some help from the class Discord, I implemented it using an attack boolean. Although this increased the amount of code I had, the attack was working fine now. I added a sword slash sound to make it more realistic. If the skeleton is within the range of the player and the player attacks, then the skeleton would collapse into a pile of bones, and bones falling soundtrack would be played.
For my enemies, I used the skeleton sprites from Assets and gave it movement. To attack, I created a range where if they detected the player, the attack motion would play and if it lands on the player they would die. The corresponding sound effects are also played when the player dies.
To follow the player, I would simply use their x and y position and move the enemies accordingly. You can see that after a while the enemies will start to pile up, but that is because they are not solid body objects so there is no collision detection. This seemed quite tricky to implement so instead, I added a random change to their speed to make sure they didn’t bunch up into one all at once.
In order to prevent the player from killing all the enemies at once, I added a break after each enemy dies so that only one skeleton can be killed with one mouse click.
The enemies also spawn once every 50 frames, with each new skeleton speeding up, and the game ends once you kill 50 skeletons.
I created classes for the Player, Skeletons, and the Stage. The stage object is where the whole game plays out. It controls the loading of the player and the enemies and handles the game logic such as showing the start, end, and playing screen. It also allows the player to restart the game when they die or lose.
w – move up
s – move down
a – move left
d – move right
mouse left click – attack