-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nick B
committed
Aug 28, 2024
1 parent
9094957
commit 3fdfbee
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
abstract class GraphicObject { | ||
PVector location; | ||
PVector velocity; | ||
PVector acceleration; | ||
|
||
color fillColor = color (255); | ||
color strokeColor = color (255); | ||
float strokeWeight = 1; | ||
|
||
abstract void update(int deltaTime); | ||
|
||
abstract void display(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
class Particle { | ||
PVector position; | ||
PVector velocity; | ||
PVector acceleration; | ||
|
||
Particle() { | ||
position = new PVector(width/2, height/2); | ||
velocity = new PVector(random(-1, 1), random(-2, 0)); | ||
acceleration = new PVector(0, 0.05); | ||
} | ||
|
||
Particle(PVector l) { | ||
position = l.copy(); | ||
velocity = new PVector(random(-1, 1), random(-2, 0)); | ||
acceleration = new PVector(0, 0.05); | ||
} | ||
|
||
void update() { | ||
velocity.add(acceleration); | ||
position.add(velocity); | ||
acceleration.mult(0); | ||
} | ||
|
||
void display() { | ||
stroke(0); | ||
fill(175); | ||
ellipse(position.x, position.y, 10, 10); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
int currentTime; | ||
int previousTime; | ||
int deltaTime; | ||
|
||
void setup() { | ||
size (800, 600); | ||
} | ||
|
||
void draw() { | ||
currentTime = millis(); | ||
deltaTime = currentTime - previousTime; | ||
previousTime = currentTime; | ||
|
||
update(deltaTime); | ||
display(); | ||
} | ||
|
||
void update(int deltaTime) { | ||
|
||
} | ||
|
||
void display() { | ||
|
||
} |