Inspiration This video game was inspired by the Chrome Dinosaur Game. It was also inspired by the retro style from the 1960s.

What it does The player controls the detective on the screen and jumps over obstacles. It also displays a background and an animation at the beginning to tell a story. When the player hits an obstacle the game ends and a game-over screen is displayed.

How it was built There were three main stages to building this application. First, the game itself was developed with simple rectangles on the screen. Here, the physics regarding jumping was developed. The initial jump velocity and gravity were calculated by taking the first and second derivative of the wanted parabola. The collision detection aspect of the game was also developed here. Then, I went on the internet to find a GIF animation of a detective running and images of trash cans, road blocks, and crates. Photoshop was used to make the backgrounds of the images transparent. After that, I downloaded seamless images of cities and clouds. I assigned appropriate velocities to each layer to create an illusion of motion (the clouds move slower than the city). Finally, the animations and final touches were added.

Challenges I ran into There were many challenges that I ran into. First, the collision detection code failed to work because of a logic error. After that, I struggled for an hour to remove the background from the GIF of the detective. Because of the way the JFrame worked, the transparent regions were displayed as black. Then, the game ran at an extremely low frame rate because the algorithms were too inefficient. This was solved by removing all unnecessary entities. Finally, when I attempted to find a good size for the window, all of the objects and animations were disproportionate since their properties were hard-coded.

Accomplishments that I’m proud of I’m proud that I finished everything on time—eight hours is enough to make a game and write an essay, but far too short to do it peacefully. I’m also proud that I fixed all of the problems encountered (on time) and figured out all the math. In total, the project consisted of about 1000 lines of code.

What I learned I learned how to configure the build path of resources and access those resources with their path. I also learned algorithms regarding collision detection. Additionally, I learned how to export Java projects into JAR files, and convert them into EXE files.

What's next for Detective Runner Not much, really.

Built With

Share this project:

Updates