diff --git a/BasicImages/BasicImages.pde b/BasicImages/BasicImages.pde index 8b13789..17a6ae6 100644 --- a/BasicImages/BasicImages.pde +++ b/BasicImages/BasicImages.pde @@ -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); +} \ No newline at end of file diff --git a/BasicImages/data/firework.jpg b/BasicImages/data/firework.jpg new file mode 100644 index 0000000..6f728fd Binary files /dev/null and b/BasicImages/data/firework.jpg differ diff --git a/BasicImages/data/reddit-logo.png b/BasicImages/data/reddit-logo.png new file mode 100644 index 0000000..86d73bb Binary files /dev/null and b/BasicImages/data/reddit-logo.png differ diff --git a/FilteringImages/FilteringImages.pde b/FilteringImages/FilteringImages.pde index 8b13789..553a140 100644 --- a/FilteringImages/FilteringImages.pde +++ b/FilteringImages/FilteringImages.pde @@ -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); +} \ No newline at end of file diff --git a/FilteringImages/data/bpmc.jpg b/FilteringImages/data/bpmc.jpg new file mode 100644 index 0000000..87976ef Binary files /dev/null and b/FilteringImages/data/bpmc.jpg differ diff --git a/IndependentImagePractice/IndependentImagePractice.pde b/IndependentImagePractice/IndependentImagePractice.pde index 8b13789..041d443 100644 --- a/IndependentImagePractice/IndependentImagePractice.pde +++ b/IndependentImagePractice/IndependentImagePractice.pde @@ -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; + } + } + } +} \ No newline at end of file diff --git a/IndependentImagePractice/data/BulletHoles.png b/IndependentImagePractice/data/BulletHoles.png new file mode 100644 index 0000000..5ccb7dd Binary files /dev/null and b/IndependentImagePractice/data/BulletHoles.png differ diff --git a/IndependentImagePractice/data/blood.jpeg b/IndependentImagePractice/data/blood.jpeg new file mode 100644 index 0000000..6017faf Binary files /dev/null and b/IndependentImagePractice/data/blood.jpeg differ diff --git a/IndependentImagePractice/data/target.png b/IndependentImagePractice/data/target.png new file mode 100644 index 0000000..9126469 Binary files /dev/null and b/IndependentImagePractice/data/target.png differ diff --git a/MaskingImages/MaskingImages.pde b/MaskingImages/MaskingImages.pde index 8b13789..b2383e8 100644 --- a/MaskingImages/MaskingImages.pde +++ b/MaskingImages/MaskingImages.pde @@ -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); +} \ No newline at end of file diff --git a/MaskingImages/asloth.jpg b/MaskingImages/asloth.jpg new file mode 100644 index 0000000..75515a1 Binary files /dev/null and b/MaskingImages/asloth.jpg differ diff --git a/MaskingImages/moun.gif b/MaskingImages/moun.gif new file mode 100644 index 0000000..d6fdcdd Binary files /dev/null and b/MaskingImages/moun.gif differ diff --git a/raindropGameCode/Catcher.pde b/raindropGameCode/Catcher.pde new file mode 100644 index 0000000..bc4ad3a --- /dev/null +++ b/raindropGameCode/Catcher.pde @@ -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); + } +} \ No newline at end of file diff --git a/raindropGameCode/Raindrop.pde b/raindropGameCode/Raindrop.pde new file mode 100644 index 0000000..dd56a4a --- /dev/null +++ b/raindropGameCode/Raindrop.pde @@ -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; + } +} \ No newline at end of file diff --git a/raindropGameCode/data/plane.png b/raindropGameCode/data/plane.png new file mode 100644 index 0000000..1dfaf72 Binary files /dev/null and b/raindropGameCode/data/plane.png differ diff --git a/raindropGameCode/data/planedown.png b/raindropGameCode/data/planedown.png new file mode 100644 index 0000000..d3b9418 Binary files /dev/null and b/raindropGameCode/data/planedown.png differ diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde new file mode 100644 index 0000000..e722a19 --- /dev/null +++ b/raindropGameCode/raindropGameCode.pde @@ -0,0 +1,55 @@ +PVector mouse; //declare a P +int count = 20; +int caught = 0; +//Raindrop [] x = new Raindrop[count]; +ArrayList drops = new ArrayList(); + + +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; + } + } +} \ No newline at end of file