Game Over screen

Donut Run


Give this entry an award


Ratings (show detail)

Overall: 3.2
Fun: 3.7
Production: 2.9
Innovation: 3

Respondents: 10


File Uploader Date
Donut Run - Final Game
karx 2021/04/04 16:30
Game Over screen
karx 2021/03/30 19:28
Opening Screen
karx 2021/03/30 19:26
Player fighting enemies
karx 2021/03/29 20:14
State of the game as of March 28 at 2:45
karx 2021/03/28 19:47

Diary Entries

Day 1

This time, I didn't miss the announcement, so that's cool.

I wanted to do a sort of endless shooter type game, like Galaga, which works great with the theme "cops".
Here's my idea:
You play as a cop, trying to get as many donuts as possible. However, criminals (or ninjas? idk) are guarding the donut, and they have guns.
You have to kill all the criminals and get all the donuts. When you do that, it goes to the next level/difficulty.

The first thing I did was to start the project, create a venv and a GitHub repo and all that. Once that was done, I made a window appear.

After that, I created a player sprite and added the ability to move it with the keyboard. I also made it point to the mouse's location.

Third, I added the ability to shoot bullets. This was done by listening for a click, calculating the angle between the player and the mouse, and then sending another sprite towards the x and y of where you clicked.

Finally, I created a mechanism to place walls randomly around the map, and created simple collision mechanisms.

Super excited to be doing PyWeek!

Add a comment

Day 2: Enemies and shootouts

Today, I added enemies.

The first step was to create a sprite for it. I did this in the free pixel art app called Piskel, which I used to make all of my sprites for this game. Then, I got the sprite into arcade and on the window.

Now it was time to create an AI for the enemies. The first thing I did was to get a line-of-sight algorithm working, so the enemies will move toward the player if the player is not in the line of sight. For actually moving, I had two options:
1. A-star pathfinding towards the player
2. Simply angling towards the player and going in a straight line.

I found both options to be equally effective, except the A-star method was a bit more intensive. In the end, I just opted for the second method. The enemies will check if the player is in their line of sight, and if it is not, the enemy will move toward the player until the player is in the line of sight.

Now that I could get enemies to move the player into their line of sight, it was time to make the enemies shoot at the player. To do this, I made it so that (before adjustment) there was a 1-in-200 chance that the enemy would shoot every frame. After adjusting for delta time using the following code, I had a pretty fair shooting algorithm.

adj_odds = int(200 * (1 / 60) / delta_time)
Code for adjusting odds for delta time

The next thing I did was to make a leveling system. This game is an endless shooter, and the enemies come in waves.
I did this by tracking a level variable and incrementing it when all the enemies were killed. Then, when setting up the new wave, I would spawn in the number of enemies that level contained. For example, if level is 1, I spawn in 1 enemy, if level is 2, I spawn in 2 enemies, and so on.

Combine this all together, and I had a fairly challenging game.

See you tomorrow!

Add a comment

Day 3: donuts!!!

Today, I added the main scoring mechanism of the game, donuts. (because cops eat donuts, hahaha so funny)

First, I drew a sprite using the free pixel art app Piskel. This is what it looks like:

I used the same generation algorithm as the walls and enemies to randomly place donuts around the map, based on the player's level.

I made the score increment when the player touches a donut, and killed donuts when an enemy bullet hits one.

After that, I created an introduction screen and a game over screen. This was where I reached a little issue with the arcade library, it would segfault whenever I tried to draw text. To fix this, I copied the draw_text function from the arcade library, and implemented a fix.

Here's the opening screen:

and the game over screen:

On the opening screen, I created a little function to display a helpful tip that will help the player when playing the game.

'Till Tomorrow!

Add a comment

Looking Back

The original goal for this game was to have a top-down endless shooter. The endless part, I feel, was achieved perfectly, and is everything that I wanted it to be. Random level generation, increasing difficulty, and more.

The top-down part, however, was achieved not-so-perfectly. The movement feels natural if you play like a top-down shooter, but the sprites simply don't look like those of top down shooters. Maybe I could have fixed this by increasing the pixel count, giving be the ability to increase the amount of detail I could put in the sprites. Otherwise, it would just be blue squares shooting black squares, and the "Cops" theme would be lost.

With that being said, though, I feel satisfied with how the game turned out. It's a fun, theoretically endless, virtually random, and adequately challenging game. I have high confidence that it will get good ratings (did I just jinx it? crap).

See you in October, PyWeekers!

Add a comment