Swappy Charge is a game that demonstrates the effect of electric fields on a charged particle. Players are tasked with launching a charged particle through electric fields to reach a goal pad. Players are able to manipulate the electric field by swapping (negating) the charge of certain point particles. There are also other elements of the game such as pits, walls, and pickup charges (charges that can be "picked up" to modify the player's charge).
When a player successfully launches their charged particle to the goal pad, the player advances to the next level. To beat the game, a player must complete all 20 levels. If a player is unsuccessful in reaching the goal pad, the player restarts the level. The number of deaths a player has is displayed at the bottom right of the screen.
- Coulomb's Law
- Electric fields of a point charge
- Kinematics of a moving particle
- Collisions (elastic and inelastic)
To play this game, clone the repository and open one of the .pde files in /Game
with Processing.
CURSOR
to aim the charged particlesLEFT CLICK
to launch the charged particleSPACE
to swap the charges of colored particlesBACKSPACE
to restart the levels
to skip the levelt
to toggle the display of the electric field
You may view the controls in-game by pressing c
.
By observing the interactions between the launched particle and the surrounding charges, the player will recognize that particles of opposite charges attract and those of similar charges repel. Launching the charge at different angles also reveals that electric fields are stronger when the radial distance from the center of the charge is smaller. Laws of the conservation of momentum and principles involving elastic and inelastic collisions are demonstrated when the charge collides with stationary walls and “pickup” charges (charges that affect both the velocity and charge of the proton).
- Aaron Hsu (code)
- Ellie Yu (level design)