Project 10-Sonic Story

My sonic story about the election goes as follows:

Biden and Trump meet at the white house. Trump debates biden by saying ‘Wrong’ repeatedly while smiling. Biden then bonks Trump on the head with the great state of Pennsylvania, winning him the election. Trump’s defeat music plays as he frowns and Biden smiles. Trump leaves the white house and Biden dances to his victory music.

Sounds- Wrong, Bonk (hitting on head), Bass(Trump defeat sound), winSound(Biden’s victory song)

sketch

//trump and biden meet, trump debates biden by saying wrong repeatedly while smiling, then biden bonks trump with a democratic pennsylvania, winning the election. Trump then frowns and his panic music plays, he then leaves and biden does a dance to victory music.
//sounds
var bonk;
var winSound;
var bass;
var wrong;

function preload(){
    bonk = loadSound("https://courses.ideate.cmu.edu/15-104/f2020/wp-content/uploads/2020/11/bonk-1.wav");
    winSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2020/wp-content/uploads/2020/11/Wide-1.wav");
    bass = loadSound("https://courses.ideate.cmu.edu/15-104/f2020/wp-content/uploads/2020/11/Bass-1.wav");
    wrong = loadSound("https://courses.ideate.cmu.edu/15-104/f2020/wp-content/uploads/2020/11/Wrong-1.wav");
}

function setup() {
    createCanvas(400, 400);
    useSound();
    frameRate(1);
    imageMode(CENTER);
    rectMode(CENTER);
    noStroke();
}
function soundSetup() { 
    winSound.setVolume(0.5);
}
var trumpPos=0;
var bidenPos=400;
var armrot=12;
function draw() {
    translate(200,200);
    //biden and trump slide in
    if(frameCount<8){
        drawWH();
        trumpPos+=16;
        bidenPos-=16;
        push();
        translate(trumpPos-200,0);
        drawTrump(true);
        pop();
        push();
        translate(bidenPos-200,0);
        drawBiden(false);
        pop();
    }
    //trump wrong sound
    if(frameCount==7||frameCount==8||frameCount==9){
        wrong.play();
    }
    //biden arm appears and swings
    if(frameCount>=9&frameCount<11){
        armrot-=0.2;
        drawWH();
        push();
        translate(trumpPos-200,0);
        drawTrump(true);
        pop();
        push();
        translate(80,80);
        rotate(armrot);
        drawPenn();
        pop();
        push();
        translate(bidenPos-200,0);
        drawBiden(false);
        pop();
    }
    //bonk sound effect
    if(frameCount==12){
        bonk.play();
    }
    //trump mad
    if(frameCount==13){
        drawWH();
        push();
        translate(trumpPos-200,0);
        drawTrump(false);
        pop();
        push();
        translate(80,80);
        rotate(armrot);
        drawPenn();
        pop();
        push();
        translate(bidenPos-200,0);
        drawBiden(true);
        pop();
    }
    //bass sound
    if(frameCount==14){
        bass.play();
    }
    //trump exit, biden slide
    if(frameCount>14&frameCount<19){
        drawWH();
        trumpPos-=55;
        bidenPos-=27;
        push();
        translate(trumpPos-200,0);
        drawTrump(false);
        pop();
        push();
        translate(bidenPos-200,0);
        drawBiden(true);
        pop();
    }
    //win song plays
    if(frameCount==20){
        winSound.play();
    }
    //biden wiggle
    if(frameCount>20&frameCount<25){
        drawWH();
        push();
        var rot=random(-0.3,0.6);
        rotate(rot);
        translate(bidenPos-200,0);
        drawBiden(true);
        pop();
    }
    if(frameCount==25){
        background(0);
        noLoop();
    }
}

function drawTrump(happy){
    //red suit
    fill(170,27,27);
    rect(0,200,150,400);
    //head and ears
    fill(255,173,101);
    ellipse(0,0,100,90);
    ellipse(50,0,20,40);
    ellipse(-50,0,20,40);
    //hair
    fill(255,220,88);
    ellipse(0,-35,100,50);
    fill(0);
    //smiley face
    if(happy){
        arc(0,10,40,20,0,PI,CHORD);
    }
    //sad face
    else{
        arc(0,10,40,20,PI,0,CHORD);

    }
}

function drawBiden(happy){
    //blue suit
    fill(47,62,140);
    rect(0,230,100,400);
    //hair
    fill(255);
    ellipse(0,-25,70,60);
    //head and ears
    fill(214,169,140);
    ellipse(0,0,80,100);
    ellipse(40,0,10,20);
    ellipse(-40,0,10,20);
    fill(0);
    //smiley face
    if(happy){
        arc(0,10,40,20,0,PI,CHORD);
    }
    //sad face
    else{
        arc(0,10,40,20,PI,0,CHORD);
    }
}

function drawPenn(){
    //arm
    fill(47,62,140);
    rect(0,-45,30,90);
    //hand
    fill(214,169,140);
    ellipse(0,-95,40,40);
    //state
    fill(47,62,140);
    rect(0,-160,60,120);

}

function drawWH(){
    background(82,198,205);
    //grass
    fill(53,123,42);
    rect(0,50,400,300);
    //main house
    fill(255);
    rect(0,-120,100,40);
    //tip
    triangle(0,-150, -20,-140,20,-140);
    //inside
    fill(230);
    rect(0,-118,40,32);
}

Leave a Reply