xxxxxxxxxx
128
// Ahmed and Abigail
// IIM Final Project Professor Shiloh
// December 13, 2022
// Description: A program that allows the user to interact with the Demogorgon's head from Stranger Things! Here we give the user an introduction to what they are dealing with and allow them to choose how they interact with it using Arduino.
let gameState = "start";
let font1;
let font2;
let themeSong;
var i = 0; // for flickering start screen
function preload() {
font1 = loadFont("Benguiat.ttf");
font2 = loadFont("Play-Regular.ttf")
themeSong = loadSound("themesong.mp3");
}
function setup() {
createCanvas(600, 600);
colorMode(HSB, 360, 100, 100, 100);
themeSong.loop();
themeSong.setVolume(0.6);
startScreen();
}
function draw() {
if (gameState == "start") {
startScreen();
} else if (gameState == "play") {
instructionScreen();
} else if (gameState == "end") {
interactiveScreen();
}
}
function startScreen() {
background(0);
noFill();
stroke("#FF0000");
strokeWeight(2);
textAlign(CENTER, CENTER);
textSize(50);
textFont(font1);
glow(color("#FF0000"), 20);
text("INTERACTIVE", 300, 100);
text("DEMOGORGON", 310, 150);
glow(color("#FF0000"), 20);
text("INTERACTIVE", 300, 100);
text("DEMOGORGON", 310, 150);
push();
textSize(25);
strokeWeight(1);
glow(color("#FF0000"), 5);
text("FROM", 300, 220);
glow(color("#FF0000"), 10);
text("FROM", 300, 220);
pop();
glow(color("#FF0000"), 20);
text("STRANGER", 300, 300);
text("THINGS", 310, 350);
glow(color("#FF0000"), 20);
text("STRANGER", 300, 300);
text("THINGS", 310, 350);
push();
i = i + 1;
if (i % 10 === 0) {
stroke("#FFFFFF");
rectMode(CENTER);
glow(color("#FFFFFF"), 30);
// fill with 50
fill("#FFFFFF");
rect(300, 500, 300, 50);
} else {
// all the otehr times, fill with 255
stroke("#FFFFFF");
rectMode(CENTER);
glow(color("#FFFFFF"), 30);
fill(0);
rect(300, 500, 300, 50);
}
// stroke("#FFFFFF");
// rectMode(CENTER);
// glow(color("#FFFFFF"), 30);
// rect(300, 500, 300, 50);
textSize(20);
glow(color("#FFFFFF"), 30);
text("press enter to start", 300, 495);
pop();
if (keyCode == ENTER) {
gameState = "play";
}
}
function glow(glowColor, blurriness) {
drawingContext.shadowBlur = blurriness;
drawingContext.shadowColor = glowColor;
}
function instructionScreen() {
background(0);
let i =
"Welcome. Today you will be able to interact with a Demogorgon's head. A Demogorgon is a monster that originated from the parallel dimension known as the Upside Down. It terrorizes local population as it hunts and kidnaps anyone it comes across with. This Demogorgon was captured by Eleven and is currently being studied. Here, you are able to come face to face with it without the fear of being dragged into the Upside Down. Enjoy. Don't forget to stay safe... just in case.";
textFont(font2);
textSize(25);
text("Introduction", 300, 50);
textSize(15);
textFont(font2);
text(i, 60, 50, 300, 300);
text("Press Enter When Ready to begin", 400, 400);
}