diff --git a/BasicImages/BasicImages.pde b/BasicImages/BasicImages.pde index 8b13789..bbbe43f 100644 --- a/BasicImages/BasicImages.pde +++ b/BasicImages/BasicImages.pde @@ -1 +1,20 @@ +PImage superman,funny; +int scalefactor= 1; +void setup() { + size(800,600); + frameRate(10); + superman =loadImage("pewdiepie superman.jpg"); + funny = loadImage("funny face.jpg"); + +} + +void draw() { + noFill(); + + image(funny,0,0); + + + tint ( random (255),random(255),random(255)); + image(superman,random(width),random(height)); +} \ No newline at end of file diff --git a/BasicImages/data/funny face.jpg b/BasicImages/data/funny face.jpg new file mode 100644 index 0000000..fd9353c Binary files /dev/null and b/BasicImages/data/funny face.jpg differ diff --git a/BasicImages/data/pewdiepie superman.jpg b/BasicImages/data/pewdiepie superman.jpg new file mode 100644 index 0000000..70e99bf Binary files /dev/null and b/BasicImages/data/pewdiepie superman.jpg differ diff --git a/IndependentImagePractice/IndependentImagePractice.pde b/IndependentImagePractice/IndependentImagePractice.pde index 8b13789..8e43093 100644 --- a/IndependentImagePractice/IndependentImagePractice.pde +++ b/IndependentImagePractice/IndependentImagePractice.pde @@ -1 +1,78 @@ +boolean left, right, jumping; +PImage mariofinal, floor, background; +float speed, x, y, jumpSpeed; +float origJumpSpeed ; +float gravity = 1; +void setup() { + size(800, 600); + mariofinal=loadImage("Mario-Run.png"); + floor=loadImage("floor.jpg"); + background= loadImage("mario background.jpg"); + + x=-100; + speed=5; + y=350; + jumpSpeed=-15; + origJumpSpeed=jumpSpeed; +} + +void draw() { + images(); + movemario(); + restrictmario(); +} + +void images() { + image(background, 0, 0, 800, 550); + image(mariofinal, x, y); + image(floor, 0, 550, 800, 50); +} + +void movemario() { + if (left) { // uses boolean true or false statement to move left paddle up if the left key is pressed + x = x - speed; + } + if (right) { + x = x + speed; // uses boolean true or false statement to move right if the right key is pressed + } + if (jumping == true) { + jumpSpeed += gravity; + y += jumpSpeed; + if (y > 350) { + y = 350; + jumping = false; + jumpSpeed = origJumpSpeed; + } + } +} + + +void keyPressed() { + if (keyCode == LEFT) { + left = true; + } + if (keyCode == RIGHT) { + right = true; + } + if (keyCode == UP) { + jumping =true; + } +} + +void keyReleased() { + + if (keyCode == LEFT) { + left = false; + } + if (keyCode == RIGHT) { + right = false; + } +} + + +void restrictmario() { + if (x - speed < -100) { + x = x + speed; + } +} \ No newline at end of file diff --git a/IndependentImagePractice/data/Mario-Run.png b/IndependentImagePractice/data/Mario-Run.png new file mode 100644 index 0000000..7369643 Binary files /dev/null and b/IndependentImagePractice/data/Mario-Run.png differ diff --git a/IndependentImagePractice/data/blocks.jpg b/IndependentImagePractice/data/blocks.jpg new file mode 100644 index 0000000..1440286 Binary files /dev/null and b/IndependentImagePractice/data/blocks.jpg differ diff --git a/IndependentImagePractice/data/floor.jpg b/IndependentImagePractice/data/floor.jpg new file mode 100644 index 0000000..6b4c4a1 Binary files /dev/null and b/IndependentImagePractice/data/floor.jpg differ diff --git a/IndependentImagePractice/data/mario background.jpg b/IndependentImagePractice/data/mario background.jpg new file mode 100644 index 0000000..1ecc119 Binary files /dev/null and b/IndependentImagePractice/data/mario background.jpg differ diff --git a/IndependentImagePractice/data/mariofinal.jpg b/IndependentImagePractice/data/mariofinal.jpg new file mode 100644 index 0000000..48584b5 Binary files /dev/null and b/IndependentImagePractice/data/mariofinal.jpg differ diff --git a/IndependentImagePractice/data/you win.gif b/IndependentImagePractice/data/you win.gif new file mode 100644 index 0000000..490ae6f Binary files /dev/null and b/IndependentImagePractice/data/you win.gif differ