let londonImage, istanbulImage, tokyoImage, parisImage, madridImage;
let ticketW = 150, ticketH = 100;
let currentPage = "main";
passportImage = loadImage('passport.png');
londonImage = loadImage('london.png');
istanbulImage = loadImage('istanbul.png');
tokyoImage = loadImage('tokyo.png');
parisImage = loadImage('paris.png');
madridImage = loadImage('madrid.png');
loraFont = loadFont('Lora-Regular.ttf');
bgMusic = loadSound('621091__yellowtree__90s-smooth-funk.wav');
for (let i = 0; i < 50; i++) {
type: random(["circle", "rect", "triangle"]),
color: color(random(150, 255), random(100, 255), random(100, 255), 180),
speedX: random(-0.5, 0.5),
speedY: random(-0.5, 0.5),
tickets.push({ x: 510, y: 300, city: "London", img: londonImage });
tickets.push({ x: 150, y: 300, city: "Istanbul", img: istanbulImage });
tickets.push({ x: 330, y: 350, city: "Tokyo", img: tokyoImage });
tickets.push({ x: 180, y: 150, city: "Paris", img: parisImage });
tickets.push({ x: 400, y: 180, city: "Madrid", img: madridImage });
if (currentPage === "main") {
} else if (currentPage === "cityPage") {
drawCityPage(activeCity);
function drawDynamicBackground() {
if (s.type === "circle") {
ellipse(s.x, s.y, s.size);
} else if (s.type === "rect") {
rect(s.x, s.y, s.size, s.size, 10);
} else if (s.type === "triangle") {
s.x - s.size / 2, s.y + s.size / 2,
s.x + s.size / 2, s.y + s.size / 2
if (s.x < 0) s.x = width;
if (s.x > width) s.x = 0;
if (s.y < 0) s.y = height;
if (s.y > height) s.y = 0;
function drawMainPage() {
textAlign(CENTER, CENTER);
text("Explore the World !", width / 2, 60);
let imgWidth = passportImage.width * 1.5;
let imgHeight = passportImage.height * 1.5;
let imgX = (width - imgWidth) / 2;
let imgY = (height - imgHeight) / 2;
image(passportImage, imgX, imgY, imgWidth, imgHeight);
image(t.img, t.x, t.y, ticketW, ticketH);
if (mouseOverStamp(t.x, t.y)) cursor(HAND);
function drawCityPage(city) {
drawingContext.shadowOffsetX = 5;
drawingContext.shadowOffsetY = 5;
drawingContext.shadowBlur = 10;
drawingContext.shadowColor = 'rgba(0, 0, 0, 0.5)';
fill(255, 255, 255, 220);
rect(width / 2, height / 2, 700, 450, 15);
drawingContext.shadowOffsetX = 0;
drawingContext.shadowOffsetY = 0;
drawingContext.shadowBlur = 0;
textAlign(CENTER, CENTER);
text(city, width / 2, height / 2 - 180);
textAlign(CENTER, CENTER);
"London is a global city blending history and modernity.\n\n" +
"- Visit the iconic Tower of London, a UNESCO World Heritage Site.\n" +
"- Stroll through Hyde Park, one of the city's eight royal parks.\n" +
"- Explore Camden Market for unique finds.\n" +
"- Discover the British Museum, housing treasures like the Rosetta Stone.\n\n" +
"Did you know? London has over 170 museums, making it a paradise for history buffs!";
} else if (city === "Istanbul") {
"Istanbul, where East meets West, is rich in history and culture.\n\n" +
"- Explore Hagia Sophia, a marvel of Byzantine architecture.\n" +
"- Stroll through the vibrant streets of Istiklal Avenue.\n" +
"- Savor Turkish cuisine at local eateries.\n" +
"- Take a ferry ride on the Bosphorus to enjoy stunning views of two continents.\n\n" +
"Fun fact: Istanbul spans two continents, Europe and Asia!";
} else if (city === "Tokyo") {
"Tokyo, Japan's capital, is a blend of tradition and innovation.\n\n" +
"- Witness the bustling energy at Shibuya Crossing.\n" +
"- Indulge in fresh sushi at Tsukiji Market, the world's largest seafood market.\n" +
"- Visit the serene Meiji Shrine nestled in a lush forest.\n" +
"- Experience Akihabara, the hub of otaku culture and electronics.\n\n" +
"Interesting fact: Tokyo is home to more Michelin-starred restaurants than any other city.";
} else if (city === "Paris") {
"Paris, the city of love and lights, is a cultural treasure.\n\n" +
"- Admire the Gothic beauty of Notre-Dame Cathedral.\n" +
"- Walk along the Champs-Élysées, one of the world's most famous avenues.\n" +
"- Discover the treasures of the Louvre Museum, including the Mona Lisa.\n" +
"- Savor croissants and coffee at charming Parisian cafes.\n\n" +
"Did you know? Paris has over 1,500 bakeries making world-class pastries!";
} else if (city === "Madrid") {
"Madrid, Spain's vibrant capital, is full of energy and history.\n\n" +
"- Visit the Royal Palace, the largest in Europe by floor area.\n" +
"- Explore the art collections of the Prado Museum.\n" +
"- Enjoy traditional tapas in bustling local markets.\n" +
"- Experience the lively atmosphere of Plaza Mayor.\n\n" +
"Fun fact: Madrid has the oldest restaurant in the world, Sobrino de Botín, which opened in 1725!";
text(cityInfo, width / 2, height / 2, 600, 300);
textAlign(CENTER, CENTER);
text("Back", 20 + 40, 20 + 15);
function mousePressed() {
if (currentPage === "main") {
if (mouseOverStamp(t.x, t.y)) {
currentPage = "cityPage";
} else if (currentPage === "cityPage" && mouseOverBackButton()) {
function mouseOverStamp(x, y) {
return mouseX > x && mouseX < x + ticketW && mouseY > y && mouseY < y + ticketH;
function mouseOverBackButton() {
return mouseX > 20 && mouseX < 100 && mouseY > 20 && mouseY < 50;