I have created a time table everything works, the only problem is when I click my mouse it changes to what I wanted but doesn’t go back. Can any one help. Thanks
PImage chemistry; // Declare a PImage named chemistry
PImage comsci; // Declare a PImage named comsci
PImage design; // Declare a PImage named design
PImage ela; // Declare a PImage named ela
PImage gym; // Declare a PImage named gym
PImage math; // Declare a PImage named math
PImage science; // Declare a PImage named science
PImage social; // Declare a PImage named social
String teacher1 = "David Hartley" ; // Declare a String named Teacher1, assigned the value "David Hartley"
String teacher2 = "Devin Guertin" ; // Declare a String named Teacher2, assigned the value "Deving Guertin"
String teacher3 = "Jennifer Woods"; // Declare a String named Teacher3, assigned the value "Jennifer Woods"
String teacher4 = "David Stone" ; // Declare a String named Teacher4, assigned the value "David Stone"
String teacher5 = "Abdulkadir Abdalla"; // Declare a String named Teacher5, assigned the value "Abdulkadir Abdalla"
String teacher6 = "Jefferson Le"; // Declare a String named Teacher6, assigned the value "Jefferson Le"
String teacher7 = "Feizal Merali"; // Declare a String named Teacher7, assigned the value "Feizal Merali"
String Day = "Day1"; // Declare a String named Day, assigned the value "Day1"
String course1 = "Chemistry 20" ; // Declare a String named course1, assigned the value "Chemistry 20"
String course2 = "Social Studies" ; // Declare a String named course1, assigned the value "Social Studies"
String course3 = "Physical Education"; // Declare a String named course1, assigned the value "Physical Education"
String course4 = "Design Thinking for Innovation"; // Declare a String named course1, assigned the value "Design Thinking for Innovation"
String course5 = "Computer Science" ; // Declare a String named course1, assigned the value "Computer Science"
String course6 = "Mathematics" ; // Declare a String named course1, assigned the value "Mathematics"
String course7 = "Science" ; // Declare a String named course1, assigned the value "Science"
String course8 = "English Language Arts"; // Declare a String named course1, assigned the value "English Language Arts"
String roomchem= "Room #203"; // Declare a String named roomchem, assigned the value "Room #203"
String roomsocial= "Room #208"; // Declare a String named roomsocial, assigned the value "Room #208"
String roomgym= "Red Gym"; // Declare a String named roomgym, assigned the value "Red Gym"
String roomdesign= "Room #145"; // Declare a String named roomdesign, assigned the value "Room #145"
String roomcomsci= "Room #314"; // Declare a String named roomcomsci, assigned the value "Room #314"
String roommath= "Room #229"; // Declare a String named roommath, assigned the value "Room #229"
String roomscience= "Room #303"; // Declare a String named roomscience, assigned the value "Room #303"
String roomela= "Room #322"; // Declare a String named roomela, assigned the value "Room #322"
int winter= #26619C; // Declare an int named winter, assigned the value #26619C;
int fall= #c67727; // Declare an int named fall, assigned the value #c67727;
String day1= "Day 1"; // Declare a String named day1, assigned the value "Day 1"
String season1= "Fall"; // Declare a String named season1, assigned the value "Fall"
String season2= "Winter"; // Declare a String named season2, assigned the value "Winter"
void setup() {
size (800,1000); // Makes the window 800x1000 pixels
chemistry=loadImage("chemistry.jpg"); // When The Variable "chemistry" is called it loads "chemistry.jpg"
comsci=loadImage("comsci.jpg"); // When The Variable "comsci" is called it loads "comsci.jpg"
design=loadImage("design.jpg"); // When The Variable "design" is called it loads "design.jpg"
ela=loadImage("ela.jpg"); // When The Variable "ela" is called it loads "ela.jpg"
gym=loadImage("gym.jpg"); // When The Variable "gym" is called it loads "gym.jpg"
math=loadImage("math.jpg"); // When The Variable "math" is called it loads "math.jpg"
science=loadImage("science.jpg"); // When The Variable "science" is called it loads "science.jpg"
social=loadImage("social.jpg"); // When The Variable "social" is called it loads "social.jpg"
}
// draw() loops continuously until you close the sketch window.
void draw() {
background(fall);
// Draws 4 red rectangles who's x any pos is from the center
rectMode(CORNER);
fill(255,0,0);
rect(30,135, 350,350);
rect(420,135, 350,350);
rect(30,515, 350,350);
rect(420,515, 350,350);
// Draws a blue rectangle
fill(0,0,255);
rectMode(CENTER);
rect(400, 500, 150,150);
//Writes black text
fill(#000000);
textSize(20);
text(teacher5, 90, 155);
text(course5, 90, 180);
text("Period 1", 90, 205);
text(roomcomsci, 90, 230);
//Writes black text
fill(#000000);
textSize(20);
text(teacher6, 475, 155);
text(course8, 475, 180);
text("Period 2", 475, 205);
text(roomela, 475, 230);
//Writes black text
fill(#000000);
textSize(20);
text(teacher7, 90, 535);
text(course6, 90, 560);
text("Period 3", 90, 585);
text(roommath, 90, 610);
//Writes black text
fill(#000000);
textSize(20);
text(teacher4, 475, 535);
text(course7, 470, 560);
text("Period 4", 475, 585);
text(roomscience, 475, 610);
//Writes black text
textSize(40);
text(day1, 350,510);
//Writes black text
textSize(80);
text("Timetable", 200, 100);
// loads image under the variable comsci
image(comsci, 40,240);
// loads image under the variable ela
image(ela, 460, 240);
// loads image under the variable math
image(math,40, 620);
// loads image under the variable science
image(science,460,620);
//Writes black text
textSize(20);
text(season1,600, 100);
// Makes balck box that is a button to change the timetable
fill(0);
rect(700,40,20,20);
}
// if the variable fall= #c67727 then the listed variables will equal a different one otherwise it will revert back to its original
void mouseClicked() {
if (fall==#c67727) {
fall = winter;
comsci=chemistry;
ela=social;
math=gym;
science=design;
teacher5=teacher1;
teacher6=teacher2;
teacher7=teacher3;
teacher4=teacher4;
course5=course1;
course8=course2;
course6=course3;
course7=course4;
roomcomsci=roomchem;
roomela=roomsocial;
roommath=roomgym;
roomscience=roomdesign;
season1=season2;
} else {
winter=fall;
chemistry=comsci;
social=ela;
gym=math;
design=science;
teacher1=teacher5;
teacher2=teacher6;
teacher3=teacher7;
teacher4=teacher4;
course1=course5;
course2=course8;
course3=course6;
course4=course7;
roomchem=roomcomsci;
roomsocial=roomela;
roomgym=roommath;
roomdesign=roomcomsci;
}
}