xxxxxxxxxx
104
/*
final project pitch template
4.15.2024
*/
var currentSlide = 1;
var totalSlides = 4;
var nextSlideActive = false;
var prevSlideActive = false;
// slide 2
var description =
"My final projet combines the animation project, the keyboard sampler and the interactive comic project.";
// slide 3
var interaction =
"The player can maneuver the spaceship using the Arrow keys to evade asteroids. Additionally, they have the option to adjust the game's difficulty level. Engaging sound effects accompany every key press.";
var graphicsExample;
function preload() {
graphicsExample = loadImage("htet_AnimationDesign1.jpg");
}
function setup() {
createCanvas(400, 400);
textFont("Georgia");
}
function draw() {
background(6, 154, 242);
// first slide
if (currentSlide == 1) {
textAlign(CENTER, CENTER);
textSize(40);
fill("yellow");
text("My Final Project", width / 2, height / 2);
text("by Htet", width / 2, height / 2 + 50);
}
if (currentSlide == 2) {
textSize(20);
fill("white");
textAlign(LEFT);
text(description, 50, 150, 300);
}
if (currentSlide == 3) {
textSize(20);
fill("white");
textAlign(LEFT);
text(interaction, 50, 150, 300);
}
// graphics example
if (currentSlide == 4) {
image(graphicsExample, 50, 100, 300, 200);
textAlign(CENTER);
textSize(20);
fill("white");
text(
"This is the project I will use as the foundational concept.",
50,
30,
300
);
}
nextSlideActive = button(300, 350, 60, 20, "Next");
prevSlideActive = button(40, 350, 60, 20, "Prev");
}
function mousePressed() {
if (nextSlideActive && currentSlide < totalSlides) {
currentSlide += 1;
}
if (prevSlideActive && currentSlide > 1) {
currentSlide -= 1;
}
}
// draws a button, returns whether it is active
function button(x, y, w, h, txt) {
var isActive = false;
if (mouseX > x && mouseX < x + w && mouseY > y && mouseY < y + h) {
isActive = true;
fill("yellow");
} else {
fill("white");
}
rect(x, y, w, h);
textSize(h);
fill(0);
textAlign(LEFT, TOP);
text(txt, x + 2, y + 2);
// return button state to main program
return isActive;
}