xxxxxxxxxx
let hansel;
let img_p1;
let img_p2;
let img_p3;
let img_p4;
let img_p5;
let text_p1 = "Hansel and Gretel were sent into the woods";
let text_p2 = "Hansel and Gretel found a gingerbread house and old woman";
let text_p3 = "The old woman wanted Gretel to cook Hansel so she could eat him";
let text_p4 = "Gretel tricked the old woman into the oven and escaped";
let text_p5 = "Hansel and Gretel found their way home to their father";
let page_number = 1;
function preload(){
hansel = loadSound('hanselgretel.mp3')
}
function setup() {
createCanvas(500, 400);
textAlign (CENTER);
img_p1 =loadImage('hanselone.jpg');
img_p2 =loadImage('gretwo.jpg');
img_p3 =loadImage('grethree.jpg');
img_p4 =loadImage('grefour.jpg');
img_p5 =loadImage('grefive.jpg');
hansel.play();
}
function draw() {
background(115, 147, 179);
fill(0, 100, 0);
rect (0, 380, 600, 20);
ellipse (50, 200, 100, 300);
ellipse (450, 200, 100, 300);
ellipse(100, 250, 80, 250);
ellipse (400, 250, 80, 250);
fill(75, 58, 38);
rect(44, 200, 10, 180);
rect(444, 200, 10, 180);
rect(96, 230, 5, 150);
rect(396, 230, 5, 150);
if (page_number == 1){
text(text_p1, 250, 20);
}
if (page_number == 2){
text(text_p2, 250, 20);
}
if (page_number == 3){
text(text_p3, 250, 20);
}
if (page_number == 4){
text(text_p4, 250, 20);
}
if (page_number == 5){
text(text_p5, 250, 20);
}
if (page_number == 1){
image(img_p1, 70, 30);
}
if(page_number == 2){
image(img_p2, 0, 30);
}
if(page_number == 3){
image(img_p3, 0, 30);
}
if (page_number ==4){
image(img_p4, 60, 30);
}
if(page_number == 5){
image(img_p5, 150, 150);
}
}
function keyPressed(){
page_number ++;
if (page_number > 5){
page_number =1;
}
}