# The places I want to visit

Hello

This is the further experiment from the previous exercise.

In this assignment I wanted to put

1. Names of continents appear when the mouse goes different continents.

2. When the mouse is clicked in the different continents, the pictures of flags appear where I want to visit

The name of continent shown when the mouse is placed

The flags of places I want to visit from different continents shown when the mouse is clicked

here is the code

PImage img;
int x;
int y;
color pix;
float pointillize = 2;
int value = 0;
void setup() {
size(480, 310);
//image(img, 0, 0);
imageMode(CENTER);
noStroke();
}

void draw() {

//asia
image(img, width/2, height/2); // We don’t need this anymore becayse we are drawing our own pixels
{{ if (mousePressed && (mouseButton == LEFT)) {
if (mouseX >= 300 && mouseX <= 450) {
if (mouseY >= 0 && mouseY <=160) {
} else {
value = 0 ;
}
}
}
}

//europe
{if (mousePressed && (mouseButton == LEFT)) {
if (mouseX >= 200 && mouseX <= 300) {
if (mouseY >= 0 && mouseY <=100) {
} else {
value = 0 ;
}
}
}
}
//america
{if (mousePressed && (mouseButton == LEFT)) {
if (mouseX >= 0 && mouseX <= 150) {
if (mouseY >= 0 && mouseY <=120) {
} else {
value = 0 ;
}
}
}
}
//south america
{if (mousePressed && (mouseButton == LEFT)) {
if (mouseX >= 50 && mouseX <= 170) {
if (mouseY >= 200 && mouseY <=480) {
} else {
value = 0 ;
}
}
}
}

//africa
if (mousePressed && (mouseButton == LEFT)) {
if (mouseX >= 200 && mouseX <= 300) {
if (mouseY >= 120 && mouseY <=450) {
} else {
value = 0 ;
}

}
}

//austrailia
if (mousePressed && (mouseButton == LEFT)) {
if (mouseX >= 380 && mouseX <= 455) {
if (mouseY >= 200 && mouseY <=480) {
} else {
value = 0 ;
}

}
}

image(img, width/2, height/2);// We don’t need this anymore becayse we are drawing our own pixels
///////////////////text///////////////////

//asia

if (mouseX >=300 && mouseX <= 450) {
if (mouseY >= 0 && mouseY <= 160) {
fill(0);
textSize(15);
text(“asia”, mouseX, mouseY);
}
}

//europe
if (mouseX >= 200 && mouseX <= 300) {
if (mouseY >= 0 && mouseY <=100) {
fill(0);
textSize(15);
text(“europe”, mouseX, mouseY);
}
}
//africa
if (mouseX >= 200 && mouseX <= 300) {
if (mouseY >= 120 && mouseY <=450) {
fill(0);
textSize(15);
text(“africa”, mouseX, mouseY);
}
}

//austrailia
if (mouseX >= 380 && mouseX <= 455) {
if (mouseY >= 200 && mouseY <=480) {
fill(0);
textSize(15);
text(“austrailia”, mouseX, mouseY);
}
}

//america
if (mouseX >= 0 && mouseX <= 150) {
if (mouseY >= 0 && mouseY <=120) {
fill(0);
textSize(15);
text(“america”, mouseX, mouseY);
}
}

//south america
if (mouseX >=50 && mouseX <=170) {
if ( mouseY >=200 && mouseY <= 480) {
fill(0);
textSize(15);
text(“south america”, mouseX, mouseY);
}
}
}
}

This entry was posted in Uncategorized on .