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
10 changes: 10 additions & 0 deletions BasicImages/BasicImages.pde
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
PImage test;
float scalefactor = 2;
void setup(){
test = loadImage("bpmc.jpg");
size(1000,1000);
background(0);
}

void draw(){
image(test,mouseX,mouseY,test.width*scalefactor, test.height*scalefactor);
}
Binary file added BasicImages/data/firework.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BasicImages/data/reddit-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions FilteringImages/FilteringImages.pde
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
PImage cera;

void setup(){
frameRate(10);
size(917,510);
cera = loadImage("bpmc.jpg");
background(cera);
}

void draw(){
background(cera);
image(cera,random(width),random(height),cera.width*(.16),cera.height*(.3));
filter(ERODE);
}
Binary file added FilteringImages/data/bpmc.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions IndependentImagePractice/IndependentImagePractice.pde
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
PImage target, bullet, blood;
int chk;

void setup() {
target = loadImage ("target.png");
blood = loadImage ("blood.jpeg");
size(600, 600);
imageMode(CENTER);
background(0);
image(target, width/2, height/2);
}


void draw() {

//line(200, 0, 200, height);
//line(400, 0, 400, height);
//line(0, 180, width, 180);
//line(0, 420, width, 420);
if (chk%2==0) {
if (mousePressed && mouseX > 180 && mouseX < 420 && mouseY > 200 && mouseY < 400) {
println("yes");
image(blood, width/2, height/2);
blood.mask(target);
chk+=1;
}
if (chk%2==1) {
if (mousePressed && mouseX > 180 && mouseX < 420 && mouseY > 200 && mouseY < 400) {
println("yes");
image(blood, width/2, height/2);
target.mask(blood);
chk+=1;
}
}
}
}
Binary file added IndependentImagePractice/data/BulletHoles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IndependentImagePractice/data/blood.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IndependentImagePractice/data/target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions MaskingImages/MaskingImages.pde
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
PImage sloth;
PImage moun;
float scale = 0;

void setup(){
imageMode(CENTER);
size(600,600);
sloth = loadImage("asloth.jpg");
moun = loadImage("moun.gif");
sloth.mask(moun);
}

void draw(){
background(map(mouseY, 0, height, 0, 255));

//display the mapped image
image(sloth, mouseX, mouseY);
}
Binary file added MaskingImages/asloth.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MaskingImages/moun.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions raindropGameCode/Catcher.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Catcher {
PVector loc;
PImage img;
int diam = 100;
int tnt =255;

Catcher() {
loc = new PVector();
loc.set(mouseX, mouseY);
img = loadImage("plane.png");
}

void display() {
fill(0, 50, 200);
tint(0, 153, 204, tnt);
//ellipse(mouseX, mouseY, diam, diam);
image(img, mouseX - 50 , mouseY - 50, diam, diam);
}
}
52 changes: 52 additions & 0 deletions raindropGameCode/Raindrop.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
class Raindrop {
PVector loc;
PVector vel, acc;
int diam;
float locx;
float locy;
float t;
int num;
PImage img;

Raindrop(float locx, float locy) {
t = random(200, 255);
vel = new PVector(0, random(1, 3));
acc = new PVector(0, random(.2));
loc = new PVector(locx, locy);
diam = 20;
img = loadImage("planedown.png");
}

void display() {
fill(255, 255, 255, t);
noStroke();

image(img, loc.x - 50, loc.y -50, diam, diam);

//ellipse(loc.x, loc.y, diam, diam);
}

void fall() {
loc.y += vel.y;
vel.add(acc);
}

void reset() {
loc.y = 0;
vel.y = 0;
}

void num() {
}

boolean isInContactWith(PVector c) {
boolean p;
float d = dist(loc.x, loc.y, mouseX, mouseY);
if (d-diam/2 >50) {
p = false;
} else {
p = true;
}
return p;
}
}
Binary file added raindropGameCode/data/plane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added raindropGameCode/data/planedown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions raindropGameCode/raindropGameCode.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
PVector mouse; //declare a P
int count = 20;
int caught = 0;
//Raindrop [] x = new Raindrop[count];
ArrayList<Raindrop> drops = new ArrayList<Raindrop>();


Catcher c;
// On your own, create an array of Raindrop objects instead of just one
// Use the array instead of the single object
// You can start out by just using the single Raindrop as you test


void setup() {
c = new Catcher();
size(1200, 800);
mouse = new PVector(); //initialize mouse PVector. value is irrelevant since it will be set at the start of void draw(){}
drops.add(new Raindrop(random(width), 0));
//for (int i = 0; i < count; i++) {
// x[i] = new Raindrop(random(width), random(0)) ;
//}
}



void draw() {

if ( drops.size() <2000) {
drops.add(new Raindrop(random(width), 0));
}

mouse.set(mouseX, mouseY); //set value of mouse as mouseX,mouseY
background(0, 200, 255);
c.display();

for (int i = drops.size()-1; i >= 0; i--) {
Raindrop x = drops.get(i);
x.fall(); //make the raindrop fall. It should accelerate as if pulled towards the ground by earth's gravity
x.display(); //display the raindrop
if (x.isInContactWith(mouse)) { //check to see if the raindrop is in contact with the point represented by the PVector called mouse
x.reset(); //if it is, reset the raindrop
caught++;
println(caught);
}
if (x.loc.y > height + x.diam/2) { //check to see if the raindrop goes below the bottom of the screen
x.reset(); //if it does, reset the raindrop
}
if (x.loc.x> mouseX) {
x.loc.x +=3;
}
if (x.loc.x< mouseX) {
x.loc.x -=3;
}
}
}