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
Binary file modified .DS_Store
Binary file not shown.
Binary file added StudentFolders/.DS_Store
Binary file not shown.
Binary file added StudentFolders/A3/.DS_Store
Binary file not shown.
Binary file added StudentFolders/A3/AaronH/.DS_Store
Binary file not shown.
60 changes: 60 additions & 0 deletions StudentFolders/A3/AaronH/FINALIE_DRAFT PROJECT/FINALIE_PROJECT.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

boolean task1Done = false;
boolean task2Done = false;
boolean task3Done = false;

void setup() {
size(800, 600);
textAlign(CENTER, CENTER);
textSize(16);
}

void draw() {
background(245);

textSize(28);
fill(0);
text("TASKLY", width/2, 50);

fill(task1Done ? color(150, 255, 150) : color(200, 220, 255));
ellipse(150, 150, 80, 80);
fill(0);
text("Task 1", 150, 150);

fill(task2Done ? color(150, 255, 150) : color(200, 220, 255));
ellipse(150, 280, 80, 80);
fill(0);
text("Task 2", 150, 280);

fill(task3Done ? color(150, 255, 150) : color(200, 220, 255));
ellipse(150, 410, 80, 80);
fill(0);
text("Task 3", 150, 410);



// pets
fill(255, 220, 180);
ellipse(500, 250, 150, 150);
fill(0);
text("Your Pet", 500, 250);

// spinny w.heel
fill(255, 255, 180);
ellipse(650, 450, 120, 120);
fill(0);
text("Spin", 650, 450);
}

void mousePressed() {

if (dist(mouseX, mouseY, 150, 150) < 40) {
task1Done = !task1Done;
}
if (dist(mouseX, mouseY, 150, 280) < 40) {
task2Done = !task2Done;
}
if (dist(mouseX, mouseY, 150, 410) < 40) {
task3Done = !task3Done;
}
}
Binary file not shown.
204 changes: 204 additions & 0 deletions StudentFolders/A3/AaronH/Taskly_Final_Project/Taskly_Final_Project.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
boolean task1Done = false;
boolean task2Done = false;
boolean task3Done = false;
int petSize = 150;
int points = 0;

boolean spinning = false;
float rotamt = 0;
float rotateby = 0;
String message = "";
color petColor;

void setup() {
size(800, 600);
textAlign(CENTER, CENTER);
textSize(16);
loadProgress();
}

void draw() {
background(245);
textSize(28);
fill(0);
text("TASKLY", width/2, 50);

textSize(18);
fill(50);
text("Points: " + points, width/2, 90);

fill(task1Done ? color(150, 255, 150) : color(200, 220, 255));
ellipse(150, 150, 80, 80);
fill(0);
text("Task 1", 150, 150);

fill(task2Done ? color(150, 255, 150) : color(200, 220, 255));
ellipse(150, 280, 80, 80);
fill(0);
text("Task 2", 150, 280);

fill(task3Done ? color(150, 255, 150) : color(200, 220, 255));
ellipse(150, 410, 80, 80);
fill(0);
text("Task 3", 150, 410);

if (points < 30) {
petColor = color(255, 220, 180);
} else if (points < 70) {
petColor = color(180, 255, 180);
} else {
petColor = color(180, 200, 255);
}

fill(petColor);
ellipse(500, 250, petSize, petSize);
fill(0);
text("Your Pet", 500, 180);
fill(0);
ellipse(480, 240, 10, 10);
ellipse(520, 240, 10, 10);

if (points < 70) {
noFill();
stroke(0);
arc(500, 265, 40, 20, 0, PI);
} else {
fill(0);
arc(500, 270, 40, 20, PI, TWO_PI);
}

pushMatrix();
translate(650, 450);
rotate(radians(rotamt));

for (int i = 0; i < 10; i++) {
if (i % 2 == 0) {
fill(255);
} else {
fill(0);
}
arc(0, 0, 200, 200, i * TWO_PI / 10, (i + 1) * TWO_PI / 10, PIE);
}

circle(0, -100, 10);
fill(255, 0, 0);
textSize(20);

for (int i = 0; i < 10; i++) {
text(i, 0, -70);
rotate(TWO_PI/10);
}

popMatrix();
fill(255, 0, 0);
triangle(650 - 10, 450 - 110, 650 + 10, 450 - 110, 650, 450 - 80);

fill(0);
text("Spin", 650, 450);

fill(255, 100, 100);
rect(700, 20, 80, 30, 10);
fill(0);
textSize(16);
text("Restart", 740, 35);

if (message != "") {
fill(0, 150, 0);
textSize(18);
text(message, width/2, 550);
}

if (spinning) {
rotamt += rotateby;
rotateby *= 0.98;

if (rotamt > 360) {
rotamt -= 360;
}

if (abs(rotateby) < 0.1) {
spinning = false;
rotateby = 0;

float angle = rotamt - 15;
if(angle < 0){
angle += 360;
}

int slice = int(map(angle, 360, 0, 0, 10));

boolean isWhite = (slice % 2 == 1);
int gained = isWhite ? int(random(30, 80)) : int(random(10, 40));

points += gained;
message = (isWhite ? "White!" : "Black!") + " +" + gained + " Points!";
saveProgress();
}
}
}

void mousePressed() {
if (dist(mouseX, mouseY, 150, 150) < 40) {
task1Done = !task1Done;
petSize += task1Done ? 10 : -10;
points += task1Done ? 10 : -10;
saveProgress();
}

if (dist(mouseX, mouseY, 150, 280) < 40) {
task2Done = !task2Done;
petSize += task2Done ? 10 : -10;
points += task2Done ? 10 : -10;
saveProgress();
}

if (dist(mouseX, mouseY, 150, 410) < 40) {
task3Done = !task3Done;
petSize += task3Done ? 10 : -10;
points += task3Done ? 10 : -10;
saveProgress();
}

if (dist(mouseX, mouseY, 650, 450) < 80 && !spinning) {
spinning = true;
rotateby = 10;
message = "";
}

if (mouseX > 700 && mouseX < 780 && mouseY > 20 && mouseY < 50) {
resetProgress();
}
}

void saveProgress() {
String[] data = {
str(points),
str(petSize),
str(task1Done),
str(task2Done),
str(task3Done)
};
saveStrings("save.txt", data);
}

void resetProgress() {
points = 0;
petSize = 150;
task1Done = false;
task2Done = false;
task3Done = false;
message = "Progress Reset!";
saveProgress();
}

void loadProgress() {
java.io.File file = new java.io.File(sketchPath("save.txt"));
if (!file.exists()) return;

String[] data = loadStrings("save.txt");
points = int(data[0]);
petSize = int(data[1]);
task1Done = data[2].equals("true");
task2Done = data[3].equals("true");
task3Done = data[4].equals("true");
}
5 changes: 5 additions & 0 deletions StudentFolders/A3/AaronH/Taskly_Final_Project/save.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
0
150
false
false
false
76 changes: 76 additions & 0 deletions StudentFolders/A3/AaronH/badMario/badMario.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
float rectX = 400;
float rectY = 300;
float rectWidth = 60;
float rectHeight = 40;

float gravity = 0.6;
float velocity = 0;
boolean isJumping = false;

float moveSpeed = 5;
boolean onBox = false;

import java.util.HashSet;
HashSet<Integer> keysDown = new HashSet<Integer>();

Box b1, b2;

void setup() {
size(800, 600);
b1 = new Box(500, 400, 100, 100);
b2 = new Box(300, 250, 100, 100);
}

void draw() {
background(200);

// Draw boxes
b1.drawBox();
b2.drawBox();

customPress();

// Apply gravity
velocity += gravity;
rectY += velocity;

// Check landing on boxes
boxstuff(b1, b2);

// Floor collision
if (rectY + rectHeight > height) {
rectY = height - rectHeight;
velocity = 0;
isJumping = false;
onBox = true;
}

// Draw player
fill(255, 0, 0);
rect(rectX, rectY, rectWidth, rectHeight);
}

void customPress() {
for (Integer k : keysDown) {
if (k == 87) { // W
if (!isJumping) {
velocity = -20; // jump power
isJumping = true;
}
}
if (k == 68) { // D
rectX += moveSpeed;
}
if (k == 65) { // A
rectX -= moveSpeed;
}
}
}

void keyPressed(KeyEvent e) {
keysDown.add(e.getKeyCode());
}

void keyReleased(KeyEvent e) {
keysDown.remove(e.getKeyCode());
}
47 changes: 47 additions & 0 deletions StudentFolders/A3/AaronH/badMario/box.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
class Box {
float bx, by, bw, bh;

Box(float x, float y, float w, float h) {
bx = x;
by = y;
bw = w;
bh = h;
}

void drawBox() {
fill(255);
rect(bx, by, bw, bh);
}

void stopPlayer() {
boolean touching = rectRect(rectX, rectY, rectWidth, rectHeight, bx, by, bw, bh);

// Land on top
if (touching && rectY + rectHeight <= by + 10 && velocity >= 0 &&
rectX + rectWidth > bx && rectX < bx + bw) {
rectY = by - rectHeight;
velocity = 0;
isJumping = false;
onBox = true;
}
// Hitting sides
else if (touching && rectY + rectHeight > by && rectY < by + bh) {
if (rectX + rectWidth > bx && rectX < bx) {
rectX = bx - rectWidth; // left side
} else if (rectX < bx + bw && rectX + rectWidth > bx + bw) {
rectX = bx + bw; // right side
}
}
// Hitting bottom
else if (touching && rectY < by + bh && velocity < 0 &&
rectX + rectWidth > bx && rectX < bx + bw) {
rectY = by + bh;
velocity = 0.5;
}

// Reset onBox only if not standing on top
if (!(rectY + rectHeight == by)) {
onBox = false;
}
}
}
Loading