Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions Examples/shooter2023/shooter2023.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
ArrayList<Projectile> bullets = new ArrayList<Projectile>();
ArrayList<Target> enemies = new ArrayList<Target>();
boolean wonthegame = false;
void setup() {
//fullScreen();
size(800, 800);
for (int i = 50; i < 800; i += 100) {
enemies.add(new Target(50, i));
}
}

void draw() {
if (!wonthegame) {
background(50);
circle(400, 400, 10);
println(bullets.size());
for (Projectile p : bullets) {
p.uad();
}
for (Target t : enemies) {
t.display();
}

for (Projectile p : bullets) {
for (Target t : enemies) {
if (circleCircle(p.pos.x, p.pos.y, 5, t.pos.x, t.pos.y, t.d/2) == true) {
t.health -= 10;
p.removeme = true;
if (t.health <= 0) {
t.removeme = true;
}
}
}
}



if (mousePressed && frameCount % 5 == 0) {
bullets.add(new Projectile(400, 400, mouseX, mouseY));
}

for (int i = bullets.size() - 1; i >= 0; i--) {
Projectile p = bullets.get(i);
if (p.removeme == true) {
bullets.remove(p);
}
}

for (int i = enemies.size() - 1; i >= 0; i--) {
Target t = enemies.get(i);
if (t.removeme == true) {
enemies.remove(t);
}
}
if(enemies.size() == 0){
wonthegame = true;
}
} else {
background(0, 255, 0);
text("you win", 400, 400);
}
}

void mousePressed() {
}
25 changes: 25 additions & 0 deletions StudentFolders/A1/Reilly W/Array_list_class/Array_list_class.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ArrayList<Bouncer> bounceyballs = new ArrayList<Bouncer>();
int numBalls = 15;
void setup() {
size (800, 600);
for (int i = 0; i < numBalls; i++) {
bounceyballs.add(new Bouncer());
}
background(50);
}


void draw(){
for( int i = 0; i < numBalls; i++){
bounceyballs.get(i).display();
bounceyballs.get(i).move();

}
}


void keyPressed(){
for(int i = 0; i<numBalls; i++){
bounceyballs .get(i).randomizeColor();
}
}
35 changes: 35 additions & 0 deletions StudentFolders/A1/Reilly W/Array_list_class/bouncer.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class Bouncer {
PVector pos;
PVector v;
float size = 50;
color c;

Bouncer() {
pos = new PVector(random(100, 700), random(100, 500));
v = new PVector(random(-5, 5), random(-5, 5));
size = random(10.0, 50.0);
c = color(50);
}

void move() {
pos.add(v);

if (pos.x>width-size/2 || pos.x<size/2) {
v.x *= -1;
randomizeColor();
}
if (pos.y>height-size/2 || pos.y<size/2) {
v.y *= -1;
randomizeColor();
}
}
void display() {
//stroke(255);
noStroke();
fill(c);
circle(pos.x, pos.y, size);
}
void randomizeColor(){
c = color(random(255), random(255), random(255), random(10, 50));
}
}
27 changes: 27 additions & 0 deletions StudentFolders/A1/Reilly W/Array_of_Images/Array_of_Images.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
PImage img;
PImage img2;
PImage[] pics = new PImage[5];
int x = 0;
void setup() {
size(800, 600);
img = loadImage("jett.5.png");
img2 = loadImage("reyna.5.png");
pics[2] =loadImage("yoru.png");

imageMode(CENTER);
}

void draw() {
/*background(50);*/
image(img, mouseX - 150, mouseY);
image(img2, mouseX +150, mouseY);
println(x);
}


void keyPressed() {
if (key == ' ') {
x = int(random(10, 100)) ;
println(x);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions StudentFolders/A1/Reilly W/Party_text/Party_text.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CoolText word;


void setup() {
size (800, 600);
word = new CoolText(400, 300, "Hello");
}

void draw() {
background(50);
word.display();
//word.partyTime();
}

void keyPressed() {
if (key == ' ' ) {
word.toggleParty();
}
if (key == 'p') {
word.togglePulse();
}
}
57 changes: 57 additions & 0 deletions StudentFolders/A1/Reilly W/Party_text/coolText.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
class CoolText {
PVector pos;
String text;
float size;
float maxSize;
float minSize;
color c;
boolean flash;
float change;
boolean pulse;
CoolText(float x, float y, String text) {
this.text = text;
pos = new PVector(x, y);
size = 50;
maxSize = 50;
minSize = 10;
c = color(255);
flash = false;
pulse = false;
change = 3;
}


void display() {
if (pulse == true){
pulse();
}
if (flash == true) {
partyTime();
}
fill(c);
textAlign(CENTER, CENTER);
textSize(size);
text(text, pos.x, pos.y);
}

void pulse() {

size = size + change;
if (size>maxSize || size < minSize) {
change *= -1;
}
}

void partyTime() {
c = color(random(0, 255), random(0, 255), random(0, 255));
line(400, 0, 400, 100);
fill(c);
circle(400, 100, 50);
}
void toggleParty() {
flash = !flash;
}
void togglePulse() {
pulse =!pulse;
}
}
58 changes: 58 additions & 0 deletions StudentFolders/A1/Reilly W/Shooting_thing/Shooting_thing.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*

Class ENEMY,
red
can move(.move)
can shoot(.shoot)
OBJECT
hp(int, not set)
shooting cooldown(int, not set)
strength(int, set)
*/

ArrayList<PVector> bpos = new ArrayList<PVector>();
PVector shippos = new PVector (400, 550);
PVector enemypos = new PVector (400, 75);
int score = 0;



void setup() {
size(800, 600);


println(bpos.size());
}


void draw() {
background(50);
textSize(40);
text(score, 30, 30);
println(bpos.size());
circle(shippos.x, shippos.y, 40);
circle(enemypos.x, enemypos.y, 50);
shippos.x = mouseX;
shippos.y = mouseY;

for (int i =0; i < bpos.size(); i++) {
circle(bpos.get(i).x, bpos.get(i).y, 10);
//bpos.get(i).y -= 5;
PVector temp = bpos.get(i);
circle(temp.x, temp.y, 10);
temp.y -= 5;
if(circleCircle(temp.x, temp.y, 5, enemypos.x, enemypos.y, 25)){
bpos.get(i).x = -100;
score ++;
enemypos.x = random(50, 750);
}
}


}

void keyPressed() {
if (key == ' ') {
bpos.add(new PVector(shippos.x, shippos.y));
}
}
Loading