xxxxxxxxxx
179
let fps = 60;
let currSec = 0;
let scene = 0;
let cloudNum = 5;
let myFont;
let title_S, cloud_1, cloud_2, cloud_3, cloud_4, meImg, carmine, hourgalss, memory1, memory2, memory3, memory4;
let clouds = [];
let me;
let y = 0;
let vid
function preload() {
myFont = loadFont("Pixel.ttf");
myFont2 = loadFont("PixelSa.ttf");
title_S = loadImage('Title.png');
cloud_1 = loadImage('Cloud_1.png');
meImg = loadImage('meImg.png');
carmine = loadImage('carmine.png');
vid = createVideo('transition.mp4');
hourglass = loadImage('hourglass.png');
memory1 = loadImage('memory1.png');
memory2 = loadImage('memory2.png');
memory3 = loadImage('memory3.png');
memory4 = loadImage('memory4.png');
}
function setup() {
createCanvas(640, 360);
noStroke();
frameRate(fps);
y = 359;
vid.loop();
vid.hide();
for (let i = 0; i < cloudNum; i++) {
clouds[i] = new Cloud(random(width), random(height - 160));
}
me = new Emi(10, 220)
}
function draw() {
switch (scene) {
case 0:
title_scene();
break;
case 1:
clear();
backStory();
break;
case 2:
clear();
appartment();
me.body();
break;
case 3:
cutScene();
break;
case 4:
winScene();
break;
}
}
function title_scene() {
push();
background(41, 171, 226);
for (let i = 0; i < 5; i++) {
clouds[i].body();
clouds[i].move();
}
image(title_S, 0, 10);
textFont(myFont);
textSize(38);
fill(208, 21, 76);
text('The Journey', 20, 100);
text('Home', 130, 145);
textSize(20);
text('START', 155, 200);
pop();
}
function mouseClicked() {
if (mouseY >= 180 && mouseY <= 200 && mouseX >= 155 && mouseX <= 240 && scene == 0) {
scene++
}
}
function backStory() {
push()
background(0);
let s = `After unsuccessfully applying 3 times for an H1B visa, I followed my lawyer's advice to enroll in ANYTHING that would grant me a student visa to stay in the US. I decided to pursue one of my dreams, enrolling in flight school to receive a private pilot license.
I left NYC at the end of November 2014, destination Italy, to get my new F1 visa and spend the Xmass holidays with my family, with plans to return to NYC at the end of January to start my training.
Unfortunately, the American Embassy in Milan had different plans. They denied my request for a new F1 and, for all intents, locked me out of the US.
I will finally be able to go back to the States and to my apartment in January 2021 after more than 6 years! Much has changed in 6 years, the city has changed, friends have moved away, relationships have ended. What did not change is my apartment, a sealed time capsule stuck 6 years ago.`
fill(255)
textSize(15);
textLeading(25);
textFont(myFont2)
text(s, 20, y, 600, height * 10)
y -= 5;
pop()
if (y < -600) {
scene++;
}
}
function appartment() {
image(carmine, 0, 0);
textFont(myFont);
textSize(20);
fill(255, 255, 255);
text('13', 240, 190)
me.body();
me.move();
}
function cutScene() {
push()
image(vid,0,0);
pop()
}
class Cloud {
constructor(x, y) {
this.x = x;
this.y = y;
this.w = 10
this.h = 15
}
body() {
push()
rect(this.x, this.y, this.w, this.h);
imageMode(CENTER);
image(cloud_1, this.x, this.y, cloud_1.width / 2, cloud_1.height / 2);
pop()
}
move() {
this.x--;
if (this.x < 0) {
this.x = width;
}
}
}
class Emi {
constructor(x, y) {
this.x = x;
this.y = y;
this.w = 10
this.h = 15
}
body() {
push();
image(meImg, this.x, this.y, meImg.width / 10, meImg.height / 10);
}
move() {
if (keyIsDown(39)) {
this.x += 3;
if (this.x > 240) {
scene++
}
}
}
}