stuck with text, mouse clicked brings up text, but text won't leave screen
in
Programming Questions
•
8 months ago
I feel like I am really close, but definetly stuck. I have the correspondence between mouse click and text appearing, but with current noLoop setting the text won't dissapear and image loses interactive element.
thanks for any help.
data:
//int randomNum=0;
PImage Orangeguy;
String greeting [] = {"Hi"," hey"," Hows it going"," Hello"," whatsup", "good morning"};
int greetingamount [] = {13, 16, 16, 7, 2, 1};
String ending [] = {"See You Later", "Thanks", "have a good night", "Bye", "Peace Out", "Adios"};
int endingamount [] = {12, 4, 8, 7, 3, 1};
PImage Orangeguy;
String greeting [] = {"Hi"," hey"," Hows it going"," Hello"," whatsup", "good morning"};
int greetingamount [] = {13, 16, 16, 7, 2, 1};
String ending [] = {"See You Later", "Thanks", "have a good night", "Bye", "Peace Out", "Adios"};
int endingamount [] = {12, 4, 8, 7, 3, 1};
//This math was used to determine how large to make the ellipses. The largest ellipse is one hundred,
//and the smaller ellipses all correspond, The math equation is the same for all ellipses and shows their size.
///Math(greetings): 13/16=.8125 so hi is 81.25% of hey, 7/16 = .4375, 2/16=.125
//Math(Ending): 12=100, 8=66, 7=58, 4=33, 3=25, 1=8
//here I am setting up the basic settings for the document
void setup(){
size(1200,690);
background(85, 211, 247);
smooth();
stroke(50,100,150);
strokeWeight(2);
//setting font
PFont SeanFont;
SeanFont = loadFont("ARCENA-48.vlw");
textFont(SeanFont);
//loading figure that was created in illustrator
Orangeguy = loadImage("Orange_figure2.png");
}
void setup(){
size(1200,690);
background(85, 211, 247);
smooth();
stroke(50,100,150);
strokeWeight(2);
//setting font
PFont SeanFont;
SeanFont = loadFont("ARCENA-48.vlw");
textFont(SeanFont);
//loading figure that was created in illustrator
Orangeguy = loadImage("Orange_figure2.png");
}
//for (int i = 0; i < greeting.length; i++) greeting[i];
void draw() {
//I am placing the figures on the background and
//placing the ellipses in a way I find visually appealing,
//the size of the ellipses is based on the math done before setup
//and represents the amount of times the word was spken
background(85, 211, 247);
image(Orangeguy, 200, 340);
image(Orangeguy, 800, 340);
//6 Ellipses for Greetings, from biggest to smallest, all programmed to appear when
//the mouse hovers over the related circle
fill(252, 252, 54);
ellipse(480, 80, 100, 100);
if(dist(mouseX,mouseY,480,80)<50){
fill(0, 96, 2);
text(greeting[0],465,90);
}
fill( 242, 93, 105);
ellipse(360, 70, 100, 100);
if(dist(mouseX,mouseY,360,70)<50){
fill(0, 96, 2);
text(greeting[1],320,80);
}
fill(85, 247, 116);
ellipse(390, 170, 81, 81);
if(dist(mouseX,mouseY,390,170)<50){
fill(0, 96, 2);
text(greeting[2],280,180);
}
fill(52, 60, 247);
ellipse(360, 240, 44, 44);
if(dist(mouseX,mouseY,360,240)<20){
fill(0, 96, 2);
text(greeting[3],310,240);
}
fill(173, 57, 237);
ellipse(340, 280, 13, 13);
if(dist(mouseX,mouseY,340,280)<20){
fill(0, 96, 2);
text(greeting[4],270,280);
}
fill(247, 52, 214);
ellipse(330, 300, 7, 7);
if(dist(mouseX,mouseY,330,300)<10){
fill(0, 96, 2);
text(greeting[5],250,320);
}
//6 ellipses for responses, starting from biggest
fill(252, 252, 54);
ellipse(700, 100, 100, 100);
//if (greeting[0],465,90){
//(ending[0], 700, 80);
// }
fill( 242, 93, 105);
ellipse(810, 108, 66, 66);
fill(85, 247, 116);
ellipse(765, 190 , 81, 81);
fill(52, 60, 247);
ellipse(810, 255, 44, 44);
fill(173, 57, 237);
ellipse(835, 290, 13, 13);
fill(247, 52, 214);
ellipse(850, 310, 8, 8);
//Base Level for figures
fill( 85, 247, 116);
rect( 100, 654, 1000, 100);
//placing the greetings
fill(0, 96, 2);
//text(greeting[0], 465, 90);
textSize(48);
//text(greeting[1], 320, 80);
//text(greeting[2], 280, 180);
//text(greeting[3], 310, 240);
//text(greeting[4], 270, 280);
//text(greeting[5], 250, 320);
//placing the endings
//text(ending[0],700, 80);
//text(ending[1],810,130);
//text(ending[2],765,190);
//text(ending[3],810,230);
//text(ending[4],845,270);
//text(ending[5],860,310);
}
void mousePressed(){
//attempted boolean code
boolean mousePressed = false;
mousePressed= true;
noLoop();
if(dist(mouseX,mouseY,480,80)<50){
fill(0, 96, 2);
text(ending[0],700,80);
}
if(dist(mouseX,mouseY,360,70)<50){
fill(0, 96, 2);
text(ending[1],810,130);
}
if(dist(mouseX,mouseY,390,170)<50){
fill(0, 96, 2);
text(ending[2],765,190);
}
if(dist(mouseX,mouseY,360,240)<20){
fill(0, 96, 2);
text(ending[3],810,230);
}
if(dist(mouseX,mouseY,340,280)<20){
fill(0, 96, 2);
text(ending[4],845,270);
}
if(dist(mouseX,mouseY,330,300)<10){
fill(0, 96, 2);
text(ending[5],860,310);
}
}
//attempted boolean code
boolean mousePressed = false;
mousePressed= true;
noLoop();
if(dist(mouseX,mouseY,480,80)<50){
fill(0, 96, 2);
text(ending[0],700,80);
}
if(dist(mouseX,mouseY,360,70)<50){
fill(0, 96, 2);
text(ending[1],810,130);
}
if(dist(mouseX,mouseY,390,170)<50){
fill(0, 96, 2);
text(ending[2],765,190);
}
if(dist(mouseX,mouseY,360,240)<20){
fill(0, 96, 2);
text(ending[3],810,230);
}
if(dist(mouseX,mouseY,340,280)<20){
fill(0, 96, 2);
text(ending[4],845,270);
}
if(dist(mouseX,mouseY,330,300)<10){
fill(0, 96, 2);
text(ending[5],860,310);
}
}
1