{"id":68782,"date":"2021-11-07T20:49:35","date_gmt":"2021-11-08T01:49:35","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=68782"},"modified":"2021-11-07T20:49:35","modified_gmt":"2021-11-08T01:49:35","slug":"project-10-sonic-story-6","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/11\/07\/project-10-sonic-story-6\/","title":{"rendered":"Project-10-Sonic Story"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><p><a class=\"p5_sketch_link\" data-width=\"480\" data-height=\"600\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/sketch-26.js\">sketch<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"480\" height=\"600\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Tim Nelson-Pyne\n\/\/tnelsonp@andrew.cmu.edu\n\/\/section C\n\/\/Assignment-10-Project\n\/\/a sound bomb drops from the sky as a zombie rises from the grave\n\/\/the sound bomb makes a musical explosion and the zombie dances to the beat\n\nvar noteImg\nvar explosionImg\nvar danceGifImg\nvar danceGif\nvar fall\nvar explosion\nvar tam\nvar beat\n\n\nvar i = 0;\n\n\nfunction preload() {\n    noteImg = loadImage(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/eighthNote.png\");\n    explosionImg = loadImage(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/musicExplosion.png\");\n    danceGifImg = loadImage(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/Mojo_the_zombie.gif\");  \n    fall = loadSound(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/falling.wav\");\n    explosion = loadSound(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/explosion.wav\");\n    tam = loadSound(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/Tam95bpm.wav\");\n    beat = loadSound(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/Beat189bpm.wav\")\n    danceGif = createImg(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/Mojo_the_zombie.gif\");\n    danceGif.hide();\n}\n\nfunction setup() {\n    createCanvas(480, 600);\n    useSound();\n    background(255);\n    frameRate(60);\n}\n\nfunction soundSetup() { \n    \n}\n\n\nfunction draw() {\n    \/\/adds one to i each frame\n    i ++;\n    background(3, 0, 50);\n    imageMode(CENTER);\n    \/\/makes the background flash multi colors when the sound bomb drops\n    if(i &gt;= 600 & i % 30 < 15) {\n        fill(random(100, 255), random(100, 255), random(100,255));\n        rect(0,0, 480, 400);\n    }\n    fill(23, 150, 20);\n    noStroke();\n    rect(0, 400, 480, 200);\n    fill(100);\n    rect(250, 325, 100, 150);\n    \/\/writes RIP on grave\n    fill(0);\n    textAlign(CENTER);\n    text(\"RIP\", 300, 375);\n    \/\/static zombie image rises from the grave\n    if (i &lt; 600){\n        image(danceGifImg, 300, 700 - map(i, 0, 600, 0, 350), 400, 400);\n        fill(23, 150, 20);\n        rect(0, 500, 480, 100); \n    }\n    \/\/plays the cartoon falling noise and tambourine loop @ start\n    if (i == 1) {\n        fall.play();\n        tam.play();\n    }\n    \/\/displays the noteImg falling\n    if (i &lt; height - 25){\n        image(noteImg, 100, i, 50, 50);\n    }\n    \/\/when the noteImg hits the ground the explosion sound plays\n    if (i == height - 25) {\n        explosion.play();\n    }\n    \/\/when the noteImg hits the ground the explosion image flashes\n    if (i &gt;= height - 25 & i % 30 < 15 && i < 800) {\n        image(explosionImg, 100, height-150, 300, 300);\n    }\n    \/\/a moment after the noteImg hits the groud the beat starts\n    if (i == 600){\n        beat.play();\n    }\n    \/\/and the zombie dances\n    if(i &gt;= 600) {\n        danceGif.show();\n        danceGif.position(0,100);\n    }\n    \/\/after the beat is over everything goes black\n    if (i &gt;= 1800) {\n        danceGif.remove();\n        fill(0);\n        rect(0, 0, 480, 600);\n        noLoop();\n    }\n\n\n    \n}\n<\/code><\/pre><\/p>\n\n\n\n<p><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketch \/\/Tim Nelson-Pyne \/\/tnelsonp@andrew.cmu.edu \/\/section C \/\/Assignment-10-Project \/\/a sound bomb drops from the sky as a zombie rises from the grave \/\/the sound bomb makes a musical explosion and the zombie dances to the beat var noteImg var explosionImg var danceGifImg var danceGif var fall var explosion var tam var beat var i = 0; &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/11\/07\/project-10-sonic-story-6\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project-10-Sonic Story&#8221;<\/span><\/a><\/p>\n","protected":false},"author":662,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[113,57],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/68782"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/users\/662"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=68782"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/68782\/revisions"}],"predecessor-version":[{"id":68791,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/68782\/revisions\/68791"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=68782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=68782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=68782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}