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
19 changes: 19 additions & 0 deletions BasicImages/BasicImages.pde
Original file line number Diff line number Diff line change
@@ -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));
}
Binary file added BasicImages/data/funny face.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/pewdiepie superman.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions IndependentImagePractice/IndependentImagePractice.pde
Original file line number Diff line number Diff line change
@@ -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;
}
}
Binary file added IndependentImagePractice/data/Mario-Run.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/blocks.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 IndependentImagePractice/data/floor.jpg
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.
Binary file added IndependentImagePractice/data/mariofinal.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 IndependentImagePractice/data/you win.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.