3 minutes
Simple Platformer
Intro
Back in high school, for an AP CS final project, I decided to make a platformer where you can tell the character to jump by yelling. As a learning experience, I chose to write it in Processing, a piece of software that advertises itself as “a flexible software sketchbook” and separate language, but is actually a library for Java which makes it very easy to work with graphics, audio, and user input.
Access the project source code on GitHub.
Image

Thought Processes and Development
As a base, before we can tie yelling to the jump features, we must first make a platformer with basic sprites, physics, and user interaction. To handle sprites, I wrote an Animation class which every CollidableObject owns. Each CollidableObject, like the main player, has a set of animations like idling, running, and jumping, so the game feels more alive than with a static moving image. The animation class handles cycling through images at the current pace to maintain the illusion of animation.
CollidableObjects represent entities within the game that the main character can interact with, such as the platforms the main character jumps up. These objects interface with logic for both collision detection (meaning we can check if the main character is standing on a box or running into a box) and physics (so the player can move around in a natural-feeling way). Both physics and AABB collision detection logic were implemented manually.
We may want different difficulties for the user to choose from, so there exists a main menu with several buttons to select a game difficulty to play on. These buttons were also manually implemented by reusing 2D collision detection logic and cleverly coloring the buttons to make them look convincing.
There are other details to cover in terms of Object-Oriented programming practices and game loop internal details, but the majority of these are relatively standard implementation details. Not so standard is the way I worked with audio input. Although Processing offers a way to get access to audio input, directly extracting amplitude is not so simple considering the presence of noise. I had extra pre-processing in an attempt to smooth out the gathered audio data, but was able to make it work best with very short, high pitch noises like claps.
Future Work
- The physics and collision detection logic specifically avoid sloped surfaces. I would like to eventually re-develop both to support sloped surfaces with a variety of possible reactions, like allowing the character to slide down the slope or allowing friction to keep the character in place. I may look more into raycasted collision detection, collision detection using the separating axis theorem, and keeping accuracy high in numerical physics calculations.
- The audio processing could be improved, possibly with a better understanding of Fourier Transforms and how audio is generally processed by computers.