Complete code examples

Contents


p5 Editor Collection

Take a look at Pippin’s Collections on p5’s editor website. There are numerous short examples of code in categories like Generative Art, Interactions, and more that might help you get somewhere interesting!

Games

Traffic Inferno

A terrifying traffic game in which you drive your pretty little cyan car around the dangerous non-streets of a black night and try not to collide with the flaming wrecks of others.

Control your car with the arrow keys. UP = accelerate. LEFT and RIGHT = turn.

Keep moving to increase your score, stop and it will decrease. Try to set a high score I guess?

Run the program Source Code Download Source

Structure

OOP States

An example of representing your program’s states using Object-Oriented Programming with inheritance and polymorphism. Reworks an earlier example of a simulation with a title, simulation, and ending. Probably the ideal way to represent your states.

Running program / Source Code / Download


Time

OOP and timers

An example of using setTimeout() in the context of a class definition specifically. Sadly, it doesn’t “just work” the way you would expect because when setTimeout() calls a function it changes the meaning of this in that function. This example shows how to avoid this with the bind() method.

Running program / Source Code / Download


Graphics

Clown chase

An example of combining images with JavaScript Objects. Two objects represented as different clown face images. The user controls one with the keyboard and the other one chases the user.

Running program / Source Code / Download

Clown chase with Object Oriented Programming

An example of combining images with Object-Oriented Programming. Two objects represented as different clown face images. The user controls one with the keyboard and the other one chases the user.

Running program / Source Code / Download

Clown chase with inheritance

An example of combining images with Object-Oriented Programming and inheritance. Two objects represented as different clown face images. The user controls one with the keyboard and the other one chases the user.

Running program / Source Code / Download


Text

Typewriter effect

A class that mimics a typewriter for displaying a specified text. With a simple example script showing a basic usage. Could be more complicated, but just tries to show the basic idea.

Running program / Source Code / Download

Magic Word

A small example of requiring the user to using typing in a specific word as a form of input. It lets the user type characters and displays them, and compares their typed input to a magic word that solves the incredibly smart riddle.

Running program / Source Code / Download


Final Projects from 2019

Here are example final projects from the 2019 edition of CART253 for you to look at and be inspired by!

Midterm Projects from 2020

Here are example midterm projects from the 2020 edition of CART253 for you to look at and be inspired by!

Final Projects from 2020

Here are example final projects from the 2020 edition of CART253 for you to look at and be inspired by!