xxxxxxxxxx
739
let homeScreen = true
let planetMe = false;
let pMe_a = false;
let pMe_b = false;
let pMe_c = false;
let planetV = false;
let pV_a = false;
let pV_b = false;
let planetE = false;
let pE_a = false;
let pE_b = false;
let planetMa = false;
let pMa_a = false;
let pMa_b = false;
let planetJ = false;
let pJ_a = false;
let pJ_b = false;
let planetS = false;
let pS_a = false;
let pS_b = false;
let planetU = false;
let pU_a = false;
let pU_b = false;
let planetN = false;
let pN_a = false;
let pN_b = false;
let imgMe;
let imgMeII;
let imgMeIII;
let imgV;
let imgVII;
let imgVIII;
let imgE;
let imgEII;
let imgEIII;
let imgMa;
let imgMaII;
let imgMaIII;
let imgJ;
let imgJII;
let imgJIII;
let imgS;
let imgSII;
let imgSIII;
let imgU;
let imgUII;
let imgUIII;
let imgN;
let imgNII;
let imgNIII;
var song;
function preload() {
imgMe = loadImage('Mercury1.png');
imgMeII = loadImage('Mercury2.png');
imgMeIII = loadImage('Mercury3.png');
imgV = loadImage('Venus1.png');
imgVII = loadImage('Venus2.png');
imgVIII = loadImage('Venus3.png');
imgE = loadImage('Earth1.png');
imgEII = loadImage('Earth2.png');
imgEIII = loadImage('Earth3.png');
imgMa = loadImage('Mars1.png');
imgMaII = loadImage('Mars2.png');
imgMaIII = loadImage('Mars3.png');
imgJ = loadImage('Jupiter1.png');
imgJII = loadImage('Jupiter2.png');
imgJIII = loadImage('Jupiter3.png');
imgS = loadImage('Saturn1.png');
imgSII = loadImage('Saturn2.png');
imgSIII = loadImage('Saturn3.png');
imgU = loadImage('Uranus1.png');
imgUII = loadImage('Uranus2.png');
imgUIII = loadImage('Uranus3.png');
imgN = loadImage('Neptune1.png');
imgNII = loadImage('Neptune2.png');
imgNIII = loadImage('Neptune3.png');
song = loadSound("Neko atsume Original BGM.mp3");
}
function setup() {
createCanvas(windowWidth, windowHeight);
// song here: https://www.youtube.com/watch?v=zFuFwZISZ6g
song.loop();
}
function draw() {
if (homeScreen) {
background(40);
fill(173, 43, 133);
textSize(40);
textAlign(CENTER, TOP);
text('The Galaxy is a big and lonely place', width / 2, height / 6);
fill(173, 43, 133, 150);
textSize(25);
text('Play as Pluto to find your perfect planetary match', width / 2, height / 6 * 4.5);
solarSystem();
}
if (planetMe) {
clear();
background(40);
mercury();
fill(255);
textSize(100);
textAlign(CENTER, TOP);
text('Mercury', width / 2, height / 30 * 2);
fill(255, 150);
textSize(40);
text('What do you want out of life?', width / 2, height / 15 * 10);
textSize(30);
text('Friends and family', width / 4, height / 15 * 12);
text('Fame and glory', width / 4 * 3, height / 15 * 12);
if (pMe_a) {
clear();
background(40);
mercuryA();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('I pity you', width / 2, height / 15 * 10);
fill(255, 77, 77);
textSize(30);
text('Choose another planet', width / 4 * 3, height / 14 * 12);
} else if (pMe_b) {
clear();
background(40);
mercuryB();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('I like a planet with ambition', width / 2, height / 15 * 10);
fill(0, 153, 51)
textSize(30);
text('Next Question', width / 4 * 3, height / 14 * 12);
}
// if (pMe_c) {
// clear();
// background(40);
// mercury();
// fill(255, 150);
// textSize(40);
// text('Favorite Diva?', width / 2, height / 15 * 10);
// textSize(30);
// text('Freddie Mercury!', width / 4, height / 15 * 12);
// text('Madonna', width / 4 * 3, height / 15 * 12);
// }
}
if (planetV) {
clear();
background(40);
venus();
fill(255);
textSize(100);
textAlign(CENTER, TOP);
text('Venus', width / 2, height / 30 * 2);
fill(255, 150);
textSize(40);
text('What is my best feature?', width / 2, height / 15 * 10);
textSize(30);
text('Your hot Volcanoes', width / 4, height / 15 * 12);
text('Your personality', width / 4 * 3, height / 15 * 12);
if (pV_a) {
clear();
background(40);
venusB();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('Oh, stop it, you!', width / 2, height / 15 * 10);
text('*slaps you*', width / 2, height / 15 * 11);
fill(0, 153, 51)
textSize(30);
text('Next Question', width / 4 * 3, height / 15 * 12);
} else if (pV_b) {
clear();
background(40);
venusA();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('My personality?!', width / 2, height / 15 * 10);
fill(255, 77, 77);
textSize(30);
text('Choose another planet', width / 4 * 3, height / 15 * 12);
}
}
if (planetE) {
clear();
background(40);
earth();
fill(255);
textSize(100);
textAlign(CENTER, TOP);
text('Earth', width / 2, height / 30 * 2);
fill(255, 150);
textSize(40);
text('Hey man, am I flat?', width / 2, height / 15 * 10);
textSize(30);
text('Yes', width / 4, height / 15 * 12);
text('No way dude', width / 4 * 3, height / 15 * 12);
if (pE_a) {
clear();
background(40);
earthA();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('That was heartless bro', width / 2, height / 15 * 10);
fill(255, 77, 77);
textSize(30);
text('Choose another planet', width / 4 * 3, height / 15 * 12);
} else if (pE_b) {
clear();
background(40);
earthB();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('Thanks bro', width / 2, height / 15 * 10);
fill(0, 153, 51)
textSize(30);
text('Next Question', width / 4 * 3, height / 15 * 12);
}
}
if (planetMa) {
clear();
background(40);
mars();
fill(255);
textSize(100);
textAlign(CENTER, TOP);
text('Mars', width / 2, height / 30 * 2);
fill(255, 150);
textSize(40);
text('Have you ever seen a UFO?', width / 2, height / 15 * 10);
textSize(30);
text('That’s classified', width / 4, height / 15 * 12);
text('Are you wearing a wire?', width / 4 * 3, height / 15 * 12);
text('*you say in a whisper*', width / 4 * 3, height / 15 * 13);
if (pMa_a) {
clear();
background(40);
marsB();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('Uh-huh', width / 2, height / 15 * 10);
fill(0, 153, 51)
textSize(30);
text('Next Question', width / 4 * 3, height / 15 * 12);
} else if (pMa_b) {
clear();
background(40);
marsA();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('*whispers back*', width / 2, height / 15 * 10);
text('Are you?', width / 2, height / 15 * 11);
fill(255, 77, 77);
textSize(30);
text('Choose another planet', width / 4 * 3, height / 15 * 12);
}
}
if (planetJ) {
clear();
background(40);
jupiter();
fill(255);
textSize(100);
textAlign(CENTER, TOP);
text('Jupiter', width / 2, height / 30 * 2);
fill(255, 150);
textSize(40);
text('Your favorite thing to do with friends?', width / 2, height / 15 * 10);
textSize(30);
text('Video games at home', width / 4, height / 15 * 12);
text('Go out to a restaurant', width / 4 * 3, height / 15 * 12);
if (pJ_a) {
clear();
background(40);
jupiterB();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('Me too!', width / 2, height / 15 * 10);
fill(0, 153, 51)
textSize(30);
text('Next Question', width / 4 * 3, height / 15 * 12);
} else if (pJ_b) {
clear();
background(40);
jupiterA();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('Oh... That doesn’t sound very fun', width / 2, height / 15 * 10);
fill(255, 77, 77);
textSize(30);
text('Choose another planet', width / 4 * 3, height / 15 * 12);
}
}
if (planetS) {
clear();
background(40);
saturn();
noStroke();
fill(255);
textSize(100);
textAlign(CENTER, TOP);
text('Saturn', width / 2, height / 30 * 2);
fill(255, 150);
textSize(40);
text('Best trait a partner could have?', width / 2, height / 15 * 10);
textSize(30);
text('Intelligence', width / 4, height / 15 * 12);
text('Kindness', width / 4 * 3, height / 15 * 12);
if (pS_a) {
clear();
background(40);
saturnA();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('I’d rather be with someone who’s nice', width / 2, height / 15 * 10);
text('than someone who knows a lot', width / 2, height / 15 * 11);
fill(255, 77, 77);
textSize(30);
text('Choose another planet', width / 4 * 3, height / 15 * 12);
} else if (pS_b) {
clear();
background(40);
saturnB();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('', width / 2, height / 15 * 10);
text('There’s nothing more important', width / 2, height / 15 * 10);
text('than being kind', width / 2, height / 15 * 11);
fill(0, 153, 51)
textSize(30);
text('Next Question', width / 4 * 3, height / 15 * 12);
}
}
if (planetU) {
clear();
background(40);
uranus();
fill(255);
textSize(100);
textAlign(CENTER, TOP);
text('Uranus', width / 2, height / 30 * 2);
fill(255, 150);
textSize(40);
text('What sets you apart from others?', width / 2, height / 15 * 10);
textSize(30);
text('My optimism', width / 4, height / 15 * 12);
text('My fatalism', width / 4 * 3, height / 15 * 12);
if (pU_a) {
clear();
background(40);
uranusA();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('There is no hope...', width / 2, height / 15 * 10);
fill(255, 77, 77);
textSize(30);
text('Choose another planet', width / 4 * 3, height / 15 * 12);
} else if (pU_b) {
clear();
background(40);
uranusB();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('Even when we are together', width / 2, height / 15 * 10);
text('We are alone', width / 2, height / 15 * 11);
fill(0, 153, 51)
textSize(30);
text('Next Question', width / 4 * 3, height / 15 * 12);
}
}
if (planetN) {
clear();
background(40);
neptune();
fill(255);
textSize(100);
textAlign(CENTER, TOP);
text('Neptune', width / 2, height / 30 * 2);
fill(255, 150);
textSize(40);
text('Favorite way to listen to music?', width / 2, height / 15 * 10);
textSize(30);
text('Vinyl', width / 4, height / 15 * 12);
text('Digitally', width / 4 * 3, height / 15 * 12);
if (pN_a) {
clear();
background(40);
neptuneB();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('Interesting...', width / 2, height / 15 * 10);
fill(0, 153, 51)
textSize(30);
text('Next Question', width / 4 * 3, height / 15 * 12);
} else if (pN_b) {
clear();
background(40);
neptuneA();
fill(255, 150);
textSize(40);
textAlign(CENTER, TOP);
text('How unsuprising', width / 2, height / 15 * 10);
fill(255, 77, 77);
textSize(30);
text('Choose another planet', width / 4 * 3, height / 15 * 12);
}
}
}
function mouseClicked() {
if (mouseX >= width / 9 * 0.5 - 20 && mouseX <= width / 9 * 0.5 + 20) {
if (mouseY >= height / 2 - 20 && mouseY <= height / 2 + 20) {
planetMe = true;
}
}
if (planetMe == true) {
if (mouseY >= height / 3 * 2) {
if (mouseX <= width / 2) {
pMe_a = true;
if (pMe_a == true) {
if (mouseY >= height / 14 * 12) {
if (mouseX >= width / 8 * 5) {
// pMe_c = true;
homeScreen = true;
planetMe = false;
}
}
}
}
if (mouseX >= width / 2) {
pMe_b = true;
if (pMe_b == true) {
if (mouseY >= height / 14 * 12) {
if (mouseX >= width / 8 * 5) {
// pMe_c = true;
homeScreen = true;
planetMe = false;
}
}
}
}
}
}
if (mouseX >= width / 9 * 1.15 - 30 && mouseX <= width / 9 * 1.15 + 30) {
if (mouseY >= height / 2 - 20 && mouseY <= height / 2 + 20) {
planetV = true;
}
}
if (planetV == true) {
if (mouseY >= height / 3 * 2) {
if (mouseX <= width / 2) {
pV_a = true;
} else if (mouseX >= width / 2) {
pV_b = true;
}
}
}
if (mouseX >= width / 9 * 1.95 - 30 && mouseX <= width / 9 * 1.95 + 30) {
if (mouseY >= height / 2 - 20 && mouseY <= height / 2 + 20) {
planetE = true;
}
}
if (planetE == true) {
if (mouseY >= height / 3 * 2) {
if (mouseX <= width / 2) {
pE_a = true;
} else if (mouseX >= width / 2) {
pE_b = true;
}
}
}
if (mouseX >= width / 9 * 2.75 - 30 && mouseX <= width / 9 * 2.75 + 30) {
if (mouseY >= height / 2 - 20 && mouseY <= height / 2 + 20) {
planetMa = true;
}
}
if (planetMa == true) {
if (mouseY >= height / 3 * 2) {
if (mouseX <= width / 2) {
pMa_a = true;
} else if (mouseX >= width / 2) {
pMa_b = true;
}
}
}
if (mouseX >= width / 9 * 4 - 60 && mouseX <= width / 9 * 4 + 60) {
if (mouseY >= height / 2 - 50 && mouseY <= height / 2 + 50) {
planetJ = true;
}
}
if (planetJ == true) {
if (mouseY >= height / 3 * 2) {
if (mouseX <= width / 2) {
pJ_a = true;
} else if (mouseX >= width / 2) {
pJ_b = true;
}
}
}
if (mouseX >= width / 9 * 5.75 - 80 && mouseX <= width / 9 * 5.75 + 80) {
if (mouseY >= height / 2 - 40 && mouseY <= height / 2 + 40) {
planetS = true;
}
}
if (planetS == true) {
if (mouseY >= height / 3 * 2) {
if (mouseX <= width / 2) {
pS_a = true;
} else if (mouseX >= width / 2) {
pS_b = true;
}
}
}
if (mouseX >= width / 9 * 7.15 - 20 && mouseX <= width / 9 * 7.15 + 20) {
if (mouseY >= height / 2 - 30 && mouseY <= height / 2 + 30) {
planetU = true;
}
}
if (planetU == true) {
if (mouseY >= height / 3 * 2) {
if (mouseX <= width / 2) {
pU_a = true;
} else if (mouseX >= width / 2) {
pU_b = true;
}
}
}
if (mouseX >= width / 9 * 8.15 - 20 && mouseX <= width / 9 * 8.15 + 20) {
if (mouseY >= height / 2 - 30 && mouseY <= height / 2 + 30) {
planetN = true;
}
}
if (planetN == true) {
if (mouseY >= height / 3 * 2) {
if (mouseX <= width / 2) {
pN_a = true;
} else if (mouseX >= width / 2) {
pN_b = true;
}
}
}
}
function mercury() {
image(imgMe, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function mercuryA() {
image(imgMeII, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function mercuryB() {
image(imgMeIII, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function venus() {
image(imgV, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function venusA() {
image(imgVII, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function venusB() {
image(imgVIII, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function earth() {
image(imgE, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function earthA() {
image(imgEII, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function earthB() {
image(imgEIII, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function mars() {
image(imgMa, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function marsA() {
image(imgMaII, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function marsB() {
image(imgMaIII, width / 2 - imgMa.width / 2, height / 2 - imgMa.height / 2);
}
function jupiter() {
image(imgJ, width/2-imgJ.width/2, height/2-imgJ.height/2);
}
function jupiterA() {
image(imgJII, width / 2 - imgJ.width / 2, height / 2 - imgJ.height / 2);
}
function jupiterB() {
image(imgJIII, width / 2 - imgJ.width / 2, height / 2 - imgJ.height / 2);
}
function saturn() {
image(imgS, width/2-imgS.width/2, height/2-imgS.height/2);
}
function saturnA() {
image(imgSII, width / 2 - imgS.width / 2, height / 2 - imgS.height / 2);
}
function saturnB() {
image(imgSIII, width / 2 - imgS.width / 2, height / 2 - imgS.height / 2);
}
function uranus() {
image(imgU, width / 2 - imgU.width / 2, height / 2 - imgU.height / 2);
}
function uranusA() {
image(imgUII, width / 2 - imgU.width / 2, height / 2 - imgU.height / 2);
}
function uranusB() {
image(imgUIII, width / 2 - imgU.width / 2, height / 2 - imgU.height / 2);
}
function neptune() {
image(imgN, width/2-imgN.width/2, height/2-imgN.height/2);
}
function neptuneA() {
image(imgNII, width / 2 - imgN.width / 2, height / 2 - imgN.height / 2);
}
function neptuneB() {
image(imgNIII, width / 2 - imgN.width / 2, height / 2 - imgN.height / 2);
}
function solarSystem() {
//Mercury
noStroke();
fill(179, 178, 185);
ellipse(width / 9 * 0.5, height / 2, 20, 20);
//Venus
fill(255, 153, 15);
ellipse(width / 9 * 1.15, height / 2, 30, 30);
//Earth
fill(0, 153, 51);
ellipse(width / 9 * 1.95, height / 2, 30, 30);
//Mars
fill(255, 112, 77);
ellipse(width / 9 * 2.75, height / 2, 30, 30);
//Jupiter
fill(254, 238, 203);
ellipse(width / 9 * 4, height / 2, 100, 100);
//Saturn
fill(248, 204, 129);
ellipse(width / 9 * 5.75, height / 2, 80, 80);
stroke(149, 133, 107);
strokeWeight(10);
line(width / 9 * 5, height / 2 + 20, width / 9 * 6.5, height / 2 - 20)
//Uranus
noStroke();
fill(0, 204, 255);
ellipse(width / 9 * 7.15, height / 2, 50, 50);
//Neptune
fill(81, 106, 251);
ellipse(width / 9 * 8.15, height / 2, 50, 50);
}
//look into p5js intervals - optional