/Swappy-Charge

A game that demonstrates the effect of electric fields on charged particles

Primary LanguageProcessing

Swappy Charge

Video Demo

Description

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.

Physics Concepts Incorporated

  • Coulomb's Law
  • Electric fields of a point charge
  • Kinematics of a moving particle
  • Collisions (elastic and inelastic)

Instructions

To play this game, clone the repository and open one of the .pde files in /Game with Processing.

Controls

  • CURSOR to aim the charged particles
  • LEFT CLICK to launch the charged particle
  • SPACE to swap the charges of colored particles
  • BACKSPACE to restart the level
  • s to skip the level
  • t to toggle the display of the electric field

You may view the controls in-game by pressing c.

Notes

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).

Contributors

  • Aaron Hsu (code)
  • Ellie Yu (level design)

Screenshots

level2 level7 level10