xxxxxxxxxx
905
//Sound + bullet animations by me, the pixelated image at the end is from https://www.google.com/url?sa=i&url=https%3A%2F%2Ftheconversation.com%2Fbrexit-wisdom-of-crowds-proves-effective-predictor-of-britains-chaotic-eu-departure-119906&psig=AOvVaw1m4irXT871H-HrPAihNQ8k&ust=1605044739311000&source=images&cd=vfe&ved=0CAIQjRxqFwoTCIilid-39uwCFQAAAAAdAAAAABAD
let themeSound;
let mainSound;
let staticSound;
let peopleSound;
let titleSound;
let sceneNum = 20;
let pSpeed = 3;
let projSpeed = 2;
let f;
let left = false;
let yes = false;
let no = true;
let maybe = false;
let bigText = [];
let textNum = 0;
let health = 200;
let timer;
let timer2;
let timerTime;
let bulletVel;
let beamSpots = [];
let horBeamSpots = [];
let bulletAnim;
let downBullets;
let horBullets;
let scene1Num = 0;
let scene2Num = 0;
let scene5Num = 0;
let scene10Num = 0;
let scene11Num = 0;
let scene12Num = 0;
let scene20Num = 0;
let peopleImg;
function preload() {
f = loadFont('PressStart2P-Regular.ttf');
themeSound = loadSound('assets/ThemeMusic.mp3');
mainSound = loadSound('assets/MainMusicFixed.mp3');
staticSound = loadSound('assets/StaticFixed.mp3');
peopleSound = loadSound('5th Ave 1.mp3');
titleSound = loadSound('assets/TitleSound.mp3');
bulletAnim = loadAnimation('assets/pixil-frame-01.png', 'assets/pixil-frame-02.png', 'assets/pixil-frame-03.png', 'assets/pixil-frame-04.png', 'assets/pixil-frame-05.png', 'assets/pixil-frame-06.png', 'assets/pixil-frame-07.png', 'assets/pixil-frame-08.png', 'assets/pixil-frame-09.png', 'assets/pixil-frame-010.png', 'assets/pixil-frame-011.png', 'assets/pixil-frame-012.png', 'assets/pixil-frame-013.png', 'assets/pixil-frame-014.png');
}
function setup() {
createCanvas(600, 600);
peopleImg = loadImage('assets/output-onlinepngtools.png');
timer = 120;
timer2 = 120;
timerTime = 5000;
bulletVel = 3;
preTimer = 4000;
themeSound.loop();
mainSound.loop();
staticSound.loop();
peopleSound.loop();
titleSound.play();
bigText = ["You're a fraud.", "You're disgusting.", "You're evil.", "You belong in hell.", "Your friends pity you.", "You've made the world a worse place.", "You can't even trust your own thoughts.", "You're pathetic.", "You can't look at yourself in the mirror.", "You live to hurt people.", "You're just a burden.", "You're unlovable.", "You're being consumed by yourself."]
beamSpots = [220, 320, 420];
horBeamSpots = [height/2 + 2, height/2 + 120];
downBullets = new Group();
horBullets = new Group();
player = createSprite(
400 + 20, height/2 -20, 40, 40);
player.shapeColor = color(0, 0, 0, 0);
}
function draw() {
background(0);
soundHandler();
if(sceneNum >= 1 && sceneNum <= 9){
scene1Num++;
health -= 0.05;
}
if(sceneNum >= 5 && sceneNum <= 9){
scene5Num++;
}
if(sceneNum == 10){
scene10Num++;
}
if(sceneNum == 11){
scene11Num++;
}
if(sceneNum == 12){
scene12Num++;
}
if(sceneNum == 20){
scene20Num++;
}
// sceneNum = 20;
switch (sceneNum) { //sceneNum
case 0:
beamBullets();
horBeamBullets();
yesNo();
ellipse(50, 50, 50, 50);
controls();
break; // stop right here & exit
case 1:
bulletVel = 2;
timerTime = 300;
beamBullets();
push();
fill(0);
rect(0, 0, width, height)
pop();
controls();
drawSprites();
if(scene1Num >= 300){
player.overlap(downBullets, getHit);
}
fill(255);
textFont(f, 20);
text("Do you fear your thoughts?", 50, 100, width, 60);
// text(health, width/2, 200, width, 60);
healthBar();
yesNo();
selectionBool(yes, 2, 1, 45);
selectionBool(no, 2, 1.5, 60);
selectionBool(maybe, 2, 0.5, 20);
noHealth();
break;
case 2:
// bulletVel = 6;
// timerTime = 1700;
push();
fill(0);
rect(0, 0, width, height)
pop();
controls();
drawSprites();
player.overlap(downBullets, getHit);
push();
fill(255);
textFont(f, 20);
textAlign(CENTER);
text("Are you your thoughts incarnate?", 15, 100, width, 60);
pop();
beamBullets();
yesNo();
selectionBool(yes, 3, 1, 45);
selectionBool(no, 3, 1.2, 60);
selectionBool(maybe, 3, 0.3, 20);
healthBar();
noHealth();
break;
case 3:
// bulletVel = 6;
// timerTime = 1700;
push();
fill(0);
rect(0, 0, width, height)
pop();
controls();
drawSprites();
player.overlap(downBullets, getHit);
push();
fill(255);
textFont(f, 20);
textAlign(CENTER);
text("Do you make a difference?", 15, 100, width, 60);
pop();
beamBullets();
yesNo();
selectionBool(yes, 4, 1.2, 60);
selectionBool(no, 4, 0.7, 45);
selectionBool(maybe, 4, 0.3, 20);
healthBar();
noHealth();
break;
case 4:
// bulletVel = 6;
// timerTime = 1700;
push();
fill(0);
rect(0, 0, width, height)
pop();
controls();
drawSprites();
player.overlap(downBullets, getHit);
push();
fill(255);
textFont(f, 20);
textAlign(CENTER);
text("In a world of billions of people, you are alone.", 15, 100, width, 60);
pop();
beamBullets();
yesNo();
selectionBool(yes, 5, 0.5, 45);
selectionBool(no, 5, 1, 60);
selectionBool(maybe, 5, 0.25, 20);
healthBar();
noHealth();
break;
case 5:
// bulletVel = 6;
// timerTime = 1700;
push();
fill(0);
rect(0, 0, width, height)
pop();
controls();
drawSprites();
player.overlap(downBullets, getHit);
if(scene5Num >= 400){
player.overlap(horBullets, getHitH);
}
push();
fill(255);
textFont(f, 20);
textAlign(CENTER);
text("You're afraid of your own shadow.", 15, 100, width, 60);
pop();
horBeamBullets();
beamBullets();
yesNo();
selectionBool(yes, 6, 0.25, 45);
selectionBool(no, 6, 0.5, 60);
selectionBool(maybe, 6, 0.1, 20);
healthBar();
noHealth();
break;
case 6:
// bulletVel = 6;
// timerTime = 1700;
push();
fill(0);
rect(0, 0, width, height)
pop();
controls();
drawSprites();
player.overlap(downBullets, getHit);
player.overlap(horBullets, getHitH);
push();
fill(255);
textFont(f, 20);
textAlign(CENTER);
text("You're afraid of yourself.", 15, 100, width, 60);
pop();
horBeamBullets();
beamBullets();
yesNo();
selectionBool(yes, 7, 0.25, 45);
selectionBool(no, 7, 0.5, 60);
selectionBool(maybe, 7, 0.1, 15);
healthBar();
noHealth();
break;
case 7:
// bulletVel = 6;
// timerTime = 1700;
push();
fill(0);
rect(0, 0, width, height)
pop();
controls();
drawSprites();
player.overlap(downBullets, getHit);
player.overlap(horBullets, getHitH);
push();
fill(255);
textFont(f, 20);
textAlign(CENTER);
text("All you do is hurt the ones you love.", 15, 100, width, 60);
pop();
horBeamBullets();
beamBullets();
yesNo();
selectionBool(yes, 8, 0.25, 30);
selectionBool(no, 8, 0.5, 60);
selectionBool(maybe, 8, 0.1, 15);
healthBar();
noHealth();
break;
case 8:
push();
fill(0);
rect(0, 0, width, height)
pop();
controls();
drawSprites();
player.overlap(downBullets, getHit);
player.overlap(horBullets, getHitH);
push();
fill(255);
textFont(f, 20);
textAlign(CENTER);
text("You're a monster.", 15, 100, width, 60);
pop();
horBeamBullets();
beamBullets();
yesNo();
selectionBool(yes, 9, 0.25, 30);
selectionBool(no, 9, 0.5, 60);
selectionBool(maybe, 9, 0.1, 15);
healthBar();
noHealth();
break;
case 9:
push();
fill(0);
rect(0, 0, width, height)
pop();
controls();
drawSprites();
player.overlap(downBullets, getHit);
player.overlap(horBullets, getHitH);
push();
fill(255);
textFont(f, 20);
textAlign(CENTER);
for(i = 0; i < bigText.length; i++){
text(bigText[i], random(10, 20), random(50, 200), width, 60);
}
pop();
horBeamBullets();
beamBullets();
yesNo();
selectionBool(yes, 11, 0.25, 30);
selectionBool(no, 11, 0.5, 60);
selectionBool(maybe, 11, 0.1, 15);
healthBar();
noHealth();
break;
case 11:
push();
fill(0);
rect(0, 0, width, height)
pop();
drawSprites();
push();
fill(255, 200, 200);
textFont(f, 20);
textAlign(CENTER);
text("You'd be better off dead.", 17, 100, width, 60);
pop();
if(scene11Num >= 300){
push();
fill(255, 0, 0);
textFont(f, 16);
text("Never.", 265, height/2 + 50, width, 60);
pop();
if(keyDown('Space')) sceneNum = 12;
}
break;
case 12:
image(peopleImg, scene12Num * 0.02 * -1, 0, peopleImg.width/1.5, peopleImg.height/1.5);
push()
noStroke();
fill(0, 0, 0, scene12Num * 2);
rect(0, 45, 425, 70);
pop();
push();
fill(255, 255, 255, scene12Num * 2);
textFont(f, 16);
text("In the darkest of times", 40, 50, width, 60);
pop();
push();
fill(255, 255, 255, scene12Num * 2 - 200);
textFont(f, 16);
text("and loneliest of moments,", 30, 70, width, 60);
pop();
push();
fill(255, 255, 255, scene12Num * 2 - 400);
textFont(f, 22);
text("you are loved.", 75, 90, width, 60);
pop();
push()
noStroke();
fill(0, 0, 0, scene12Num * 2 - 1000);
rect(95, 195, 520, 70);
pop();
push();
fill(255, 255, 255, scene12Num * 2 - 1000);
textFont(f, 15);
text("You exist to everyone around you", 100, 200, width, 60);
pop();
push();
fill(255, 255, 255, scene12Num * 2 - 1200);
textFont(f, 16);
text("not as how you think", 180, 220, width, 60);
pop();
push();
fill(255, 255, 255, scene12Num * 2 - 1400);
textFont(f, 22);
text("but how you are.", 175, 240, width, 60);
pop();
push()
noStroke();
fill(0, 0, 0, scene12Num * 2 - 2000);
rect(0, 345, width, 300);
pop();
push();
fill(255, 255, 255, scene12Num * 2 - 2000);
textFont(f, 24);
text("And you're alive.", 105, 350, width, 60);
pop();
push();
fill(255, 255, 255, scene12Num * 2 - 3000);
textFont(f, 20);
text("Sometimes...", 200, 390, width, 60);
pop();
push();
fill(230, 250, 255, scene12Num * 1.7 - 3500);
rect(0, 0, width, height);
pop();
push();
fill(230, 250, 255, scene12Num * 2 - 3400);
textFont(f, 28);
text("That's the best", 105, 450, width, 60);
pop();
push();
fill(230, 250, 255, scene12Num * 2 - 3600);
textFont(f, 28);
text("you can do.", 170, 480, width, 60);
pop();
fill(0, 0, 0, scene12Num * 1.7 - 3800);
textFont(f, 20);
text("...we've got work to do.", 50, 100, width, 60);
if(scene12Num > 2500){
fill(255, 50, 0);
textFont(f, 16);
text("Press Space to Replay", 130, 400, width, 60);
if(keyDown("Space")) sceneNum = 10;
}
break;
case 10:
let textColor = 0;
let bgAlpha = 255;
let openTimer = 3000;
fill(230, 250, 255, bgAlpha);
rect(0, 0, width, height);
fill(0, 0, 0, scene10Num);
textFont(f, 20);
text("Let's walk through this...", 50, 100, width, 60);
if(scene10Num >= 255){
fill(255, 50, 0);
textFont(f, 16);
text("Press Space to Continue", 130, 400, width, 60);
health = 200;
let scene1Num = 0;
let scene2Num = 0;
let scene5Num = 0;
let scene10Num = 0;
let scene11Num = 0;
let scene12Num = 0;
if(keyDown("Space")) sceneNum = 1;
}
break;
case 20:
fill(230, 250, 255);
textFont(f, 70);
text("Process", 10, 10, width, 100);
if(scene20Num > 60){
textFont(f, 100);
text("/", 200, 80, width, 200);
}
if(scene20Num > 120){
fill(230, 250, 255);
textFont(f, 70);
text("Compulse", 10, 158, width, 100);
fill(128);
textFont(f, 24);
text("By Jay Tobin", 305, 570, width, 100);
}
if(scene20Num > 180){
fill(255, 50, 0);
textFont(f, 16);
text("Press Space to Continue", 130, 400, width, 60);
fill(128);
textFont(f, 14);
text("A S D keys to move", 185, 418, width, 100);
if(keyDown("Space")) sceneNum = 10;
}
break;
}
}
function keyPressed() {
if (key === 'a') {
yes = true;
no = false;
maybe = false;
health -= 1;
} if (key === 'd') {
yes = false;
no = true;
maybe = false;
health -= 1;
}
else if(key === 's'){
yes = false;
no = false;
maybe = true;
health -= 1;
}
}
function controls(){
if(keyDown("A")) player.position.x = 200 + 20;
if(keyDown("A")) player.position.y = height/2 + 20;
if(keyDown("D")) player.position.x = 400 + 20;
if(keyDown("D")) player.position.y = height/2 + 20;
if(keyDown("S")) player.position.x = 300 + 20;
if(keyDown("S")) player.position.y = height/2 + 100 + 20;
}
function slow(player, baggage){
pSpeed *= 0.9996;
}
function yesNo(){
if(yes == true){
push();
fill(255, 255, 0);
textFont(f, 16);
text("Yes", 200, height/2, width, 60);
pop();
push();
fill(255);
textFont(f, 14);
text("No", 400, height/2, width, 60);
pop();
push();
fill(15);
textFont(f, 14);
text("Maybe", 280, height/2 + 100, width, 60);
pop();
}
if(no == true){
push();
fill(255)
textFont(f, 14);
text("Yes", 200, height/2, width, 60);
pop();
push();
fill(255, 255, 0);
textFont(f, 16);
text("No", 400, height/2, width, 60);
pop();
push();
fill(15);
textFont(f, 14);
text("Maybe", 280, height/2 + 100, width, 60);
pop();
}
if(maybe == true){
push();
fill(255)
textFont(f, 14);
text("Yes", 200, height/2, width, 60);
pop();
push();
fill(255);
textFont(f, 14);
text("No", 400, height/2, width, 60);
pop();
push();
fill(255, 255, 0);
textFont(f, 16);
text("Maybe", 280, height/2 + 100, width, 60);
pop();
}
}
function selectionBool(m, zed, ix, timex){ //first var is bool, second is scene number
if(keyWentDown("Space") && m == true){
sceneNum = zed;
bulletVel += ix;
timerTime -= timex;
}
}
function noHealth(){
if(health <= 0){
sceneNum = 11;
}
}
function beamBullets(){
if (scene1Num > timer){
timer = timer + timerTime;
sprD = createSprite(random(beamSpots), 5);
sprD.setCollider('circle', 0, 0, 30);
sprD.addAnimation("normal", bulletAnim);
sprD.velocity.y = bulletVel;
sprD.life = 600;
downBullets.add(sprD);
}
}
function horBeamBullets(){
if (scene5Num > timer2){
timer2 = timer2 + timerTime;
sprH = createSprite(width - 5, random(horBeamSpots), 50, 50);
sprH.setCollider('circle', 0, 0, 30);
sprH.addAnimation("normal", bulletAnim)
sprH.shapeColor = color(255, 0, 0);
sprH.velocity.x = bulletVel/2 * -1;
sprH.life = 600;
horBullets.add(sprH);
}
}
function healthBar(){
push();
noStroke();
fill(170, 0, 0);
rect(width/2 - 84, 520, health, 30);
pop();
push();
strokeWeight(4);
stroke(255);
fill(0, 0, 0, 0);
rect(width/2 - 84, 520, 200, 30);
pop();
push();
fill(255);
textFont(f, 14);
text("HEALTH", width/2 - 25, 530, 60, 60);
pop();
}
function getHit(player, bulletGuy) {
health -= 20;
sprD.remove();
}
function getHitH(player, bulletGuy) {
health -= 20;
sprH.remove();
}
function soundHandler(){
if(sceneNum == 20){
titleSound.setVolume(0.5);
}
else{
titleSound.setVolume(0.0);
}
if(sceneNum == 10){
themeSound.setVolume(0.7);
}
else{
themeSound.setVolume(0.0)
}
if(sceneNum >= 1 && sceneNum <= 9){
mainSound.setVolume(0.6);
}
else{
mainSound.setVolume(0.0);
}
if(sceneNum == 11){
staticSound.setVolume(0.3);
}
else{
staticSound.setVolume(0.0);
}
if(sceneNum == 12){
peopleSound.setVolume(0.5, [2000]);
}
else{
peopleSound.setVolume(0.0);
}
if(scene12Num > 2200){
peopleSound.setVolume(0.0);
}
}