xxxxxxxxxx
222
var door_c, door_o, yellow_man, stars,fish_c,fish_o,right1,right2,mySound,right;
var scr = 1;
let x = 100;
let y = 100;
function preload() {
//image
door_c = loadImage("Untitled_Artwork-1.png");
door_o = loadImage("Untitled_Artwork-2.png");
yellow_man = loadImage("Untitled_Artwork-3.png");
stars = loadImage("Untitled_Artwork-5.png");
fish_c = loadImage("Untitled_Artwork-8.png");
fish_o = loadImage("Untitled_Artwork-9.png");
right1 = loadImage("right1.png");
right2 = loadImage("right2.png");
// right = loadAnimation('assets/right1.png', 'assets/right2.png');
//sound
mySound=loadSound('Ghost Choir.mp3');
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
imageMode(CENTER);
frameRate(12);
mySound.loop();
}
let fillVal = 126;
//let scr = 1
function draw() {
//enterDoor();
fill(fillVal);
rect(25, 25, 50, 50);
if (scr == 1) {
drawScreen1();
} else if (scr == 2) {
drawScreen2();
}
/* } else if (scr == 3) {
drawScreen3();
} else if (scr == 4) {
drawScreen4();
} else if (scr == 5) {
drawScreen5();
} else if (scr == 6) {
drawScreen6();
}*/
// move();
}
function keyPressed() {
let x = 0
if (keyCode === UP_ARROW ) {
scr = x+1;
fillVal = 255;
} else if (keyCode === DOWN_ARROW ) {
fillVal = 0;
scr = 2;
}
return false; // prevent default
}
/*
function move() {
if (keyIsDown(LEFT_ARROW)) {
x -= 5;
}
if (keyIsDown(RIGHT_ARROW)) {
x += 5;
}
if (keyIsDown(UP_ARROW)) {
y -= 5;
}
if (keyIsDown(DOWN_ARROW)) {
y += 5;
}
clear();
ellipse(x, y, 50, 50);
}
*/
function drawScreen1() {
background(225,60);
let m = random(-0.5,0.5);
image(door_c, width/2+m, height/2+m, 400+m, 400+m);
}
function drawScreen2() {
background(225,70);
let m = random(-0.2,0.2);
image(door_o, width/2-m, height/2-m, 400, 400);
function enterDoor() {
createCanvas(710, 400, WEBGL);
background(250);
let radius = width * 1.5;
//drag to move the world.
orbitControl();
normalMaterial();
translate(0, 0, -600);
for (let i = 0; i <= 12; i++) {
for (let j = 0; j <= 12; j++) {
push();
let a = (j / 12) * PI;
let b = (i / 12) * PI;
translate(
sin(2 * a) * radius * sin(b),
(cos(b) * radius) / 2,
cos(2 * a) * radius * sin(b)
);
if (j % 2 === 0) {
cone(30, 30);
} else {
box(30, 30, 30);
}
pop();
}
}
}
/*
function drawScreen3() {
let m = random(-0.2,0.2);
image(yellow_man, width/2-3-m, height/2+m,400+m,400+m);
textFont("Annie Use Your Telescope");
fill(230,162,183);
textSize(40);
text(" Hi .", 150+2*m, 450+2*m);
}
function drawScreen4() {
background(25,70);
angleMode(DEGREES);
let m = random(-1,1);
image(stars,width/2+m, height/2+m,800+m,800+m);
image(fish_c,width/2-m, height/2,400+m,400+m);
//if (mouseX<=400 && mouseX=>500){
image(right2 ,400,400, 400+m, 400+m);
//} else (right1 ,400,400, 400+m, 400+m);
}
function drawScreen5() {
background(25,70);
let m = random(-0.1,1);
image(fish_o,width/2-m, height/2,700+m,700+m);
image(stars,width/2+m, height/2+m,600+m,600+m);
rotate(m);
}
// The code inside this block is run a single time,
// each time the mouse button is pressed
function keyPressed() {
if (keyCode === UP_ARROW && scr == 1) {
fillVal = 5;
} else if (keyCode === DOWN_ARROW && scr == 1) {
fillVal = 0;
}
return false; // prevent default
}
function mousePressed() {
if (scr == 1) {
scr = 2;
} else if (scr == 2) {
// if (mouseX < 400&& mouseX > 800&&mouseY < 800&&mouseY < 1600) {
scr = 3;
} else if (mouseX > 400&& mouseX < 800&&mouseY >800&&mouseY < 1600) {
scr = 4;
} else if (scr == 3) {
scr = 1;
} else if (scr == 4) {
scr = 5;
} else if (scr == 5) {
scr = 1;
}
*/
}