For this assignment you will make a animation of fireworks. This common animation is called a "starfield" since it can also be used to simulate movement through a field of stars. You may find slides 35 - 52 on OOP--Inheritance & Encapsulation presentation helpful.
Your program must use at least two classes to model the particles. A Particle
super class and an Oddball
sub class. All the particles must be stored in a single array of the super class type. Make sure you do not unnunnecessarily duplicate inherited variables and functions in the Oddball
sub class. Your Oddball
sub class should only contain a constructor and void move()
and/or void show()
so that the Oddball
moves and/or looks different.
- Fork this repository
- First, finish the
Particle
class. It will need the following members:
- 5 member variables: X and Y positions, Color, Angle and Speed. (Hint: use doubles for X, Y, Speed and Angle)
Particle()
, the class constructorvoid move()
, Takes the cos of the angle times the speed and adds it to the X coordinate. Does the same to Y with the sin of the angle.void show()
, draws the particle in the correct color
- Now finish the program's
setup()
anddraw()
- Add one
Particle
variable, and make sure you can see it move - Add an array of type
Particle
and loop through it to move and show all the Particles. - Create an OddballParticle class that
extends
the Particle class. - Change the first element in the array to a
OddballParticle
instead of aParticle
- Run your program. Make sure you can see the Oddball.
- Submit the url of your working GitHub webpage to google classroom Extensions: Have a fun and be creative. If you have extra time you may want to modify your program and add extra features and other types and arrangements of particles. Look at student work from the links below for other variations.
Tomas
Matt
Kaitlyn
Rafael
Francesca
Vicky
Marisa
Fred
Briana
Justin
Mia
Jalen
Ethan
Andy
Albert
Annie
Jessica
Susan
Ian
David
Jessie
Marc
Amy
Racine
Kam
Ethan
Peter
Andy
Jason
Alexis
Diego
Lawrence
Willis
Brandon
Devin
Alex
Wesley
Richard
Rowan
Esther
Calvin
Audrey
Juliana
Mampu
Michael
Emma
Brendan
Michelle
Lolita
Gee
Nathan
Jayde
Joshua
Mari
Angelica
Cappillen
Jennifer
Brendan
Lucian
Wen
Yaoquan
Andrew
Alex
Freesia
Dylan
Victor
Jing
Wilson
Ryan
Natalie
Sherissa
Bryce
Melinda
Raymond
Emma
Joe
Jennifer
Ravi
Elizabeth
James
Chase
Vincent
Hiroki
Andrew
Christopher
Wilson
Ashton
Cynthia
Lalith
Gordon
Lily
Alex
Jeffrey
Alber
Ryan
Kelvin
Maryann
Jeffrey
Michelle
Benjamin
Ben
Kelly
Linus
Karlee
Trevor
Justin