{"id":68854,"date":"2021-11-08T01:54:00","date_gmt":"2021-11-08T06:54:00","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=68854"},"modified":"2021-11-08T01:58:36","modified_gmt":"2021-11-08T06:58:36","slug":"project-10-sonic-story-10","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/11\/08\/project-10-sonic-story-10\/","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=\"600\" data-height=\"400\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/sketch-36.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=\"600\" height=\"400\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Elise Chapman\n\/\/ejchapma\n\/\/ejchapma@andrew.cmu.edu\n\/\/Section D\n\n\/\/ Storyline: a mouse comes out of its hole, sees some cheese,\n\/\/ then goes over to nibble on it. It sees the shadow of a cat,\n\/\/ then scurries back to its hole.\n\nvar xPos; \/\/x position of the mouse\nvar yPos; \/\/y position of the mouse \nvar timer=0; \/\/for animation timing purposes\nvar yPosCat; \/\/y position for cat shadow\n\nfunction preload() {\n    squeak = loadSound(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/squeak.wav\");\n    aha = loadSound(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/aha.wav\");\n    nibble = loadSound(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/nibble.mp3\");\n    scream = loadSound(\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/scream.wav\");\n}\n\nfunction soundSetup() {\n    squeak.setVolume(0.5);\n    aha.setVolume(0.5);\n    nibble.setVolume(0.5);\n    scream.setVolume(0.5);\n}\n\nfunction setup() {\n    createCanvas(600,400);\n    frameRate(4); \/\/speed of story\n    xPos=(width\/2)+180;\n    yPos=(height\/2)+78;\n    yPosCat=600;\n    rectMode(CENTER);\n    noStroke();\n    useSound();\n}\n\nfunction setting() {\n    \/\/wall\n    background(240); \/\/light gray\n    fill(156,56,72); \/\/red\n    rect(width\/2,25,width,100);\n\n    \/\/mouse hole\n    fill(131,122,117); \/\/lighter grayish brown for the hole wall\n    rect((width\/2)+90,(height\/2)+50, 110,200, 80,80);\n    fill(96,91,86); \/\/grayish brown for the hole\n    rect((width\/2)+100,(height\/2)+50, 100,200, 80,80);\n\n    \/\/floor\n    fill(107,58,15); \/\/brown\n    rect(width\/2,400,width,200);\n}\n\nfunction cheese() {\n    fill(242,205,96); \/\/yellow\n    quad(100,350, 200,310, 200,235, 100,250);\n    fill(242,232,99); \/\/lighter yellow\n    quad(100,350, 60,320, 60,240, 100,250);\n    fill(228,186,62); \/\/darker yellow\n    triangle(60,240, 100,250, 200,235);\n\n    \/\/holes\n    fill(242,205,96); \/\/yellow\n    ellipse(70,300,10,30);\n    ellipse(90,280,15,40);\n    ellipse(80,320,10,20);\n    ellipse(75,260,10,20);\n}\n\nfunction mousey(x,y) {\n    stroke(170); \/\/gray\n    noFill();\n    strokeWeight(5);\n    curve(x+35,y,x+35,y,x+70,y,x+100,y-50);\n    noStroke();\n    fill(170); \/\/gray\n    rect(x,y, 70,40, 0,80,80,0);\n    arc(x-35,y+20, 70,80, PI,0);\n    fill(150); \/\/darker gray\n    ellipse(x-40,y+20,20,12);\n    ellipse(x+15,y+20,20,12);\n    ellipse(x-30,y-20,40);\n    fill(216,130,157); \/\/pink\n    ellipse(x-30,y-20,30);\n    ellipse(x-70,y+15,10,10);\n    fill(0); \/\/black\n    ellipse(x-50,y,10,10);\n}\n\nfunction catShadow(x,y) {\n    fill(50,50,50, 80);\n    ellipse(x,y,400,200);\n    ellipse(x,y+200,200,400);\n    triangle(x+50,y-100, x+200,y-25, x+150,y-150);\n    triangle(x-50,y-100, x-200,y-25, x-150,y-150);\n}\n\nfunction draw() {\n    setting();\n    cheese();\n    mousey(xPos,yPos);\n\n    \/\/to conceal mouse entering hole\n    fill(240); \/\/light gray\n    rect((width\/2)+200,(height\/2)+50, 100,100);\n    fill(107,58,15); \/\/brown\n    rect(width\/2+225,400, 150,200);\n\n    \/\/mouse movement\n    if (xPos&gt;260) {\n        xPos-=10;\n    }\n\n    \/\/cat shadow\n    catShadow(width\/2,yPosCat);\n    if (yPosCat&gt;(height\/2) & timer>23) {\n        yPosCat-=20;\n    }\n\n    if (timer&gt;32) {\n        setting();\n        cheese();\n        push();\n        translate(width,0);\n        scale(-1,1);\n        mousey(xPos+90,yPos);\n        pop();\n        fill(240); \/\/light gray\n        rect((width\/2)+225,(height\/2)+50, 150,100);\n        fill(107,58,15); \/\/brown\n        rect(width\/2+225,400, 150,200);\n        catShadow(width\/2, yPosCat);\n        if (xPos&gt;30) {\n            xPos-=20;\n        }\n    }\n\n    \/\/sound\n    if (timer==0) {\n        aha.play();\n    }\n    if (timer==16 || timer==10) {\n        aha.stop();\n        squeak.play();\n    }\n    if (timer==19) {\n        nibble.play();\n    }\n    if (timer==33) {\n        scream.play();\n    }\n\n    timer+=1;\n}\n<\/code><\/pre><\/p>\n\n\n\n\n<p><\/p>\n\n\n\n<p>When thinking of a story I could use for this assignment, I thought back to children&rsquo;s stories and cartoons. Some notable cartoons came to mind, like <em>Tom and Jerry<\/em> and Looney Tune&rsquo;s <em>Tweety Bird<\/em>, and based off of these I decided to do a cat and mouse theme. The basic story I decided on using was: &ldquo;a mouse comes out of its hole, sees some cheese, then goes over to nibble on it. It sees the shadow of a cat, then scurries back to its hole.&rdquo; To facilitate this story, I used an aha sound (for when the mouse sees the cheese), a squeak noise (to make the mouse more mousey), a nibble noise (for when the mouse is eating the cheese), and a scream (for when the mouse sees the cat). I think the story is cute and very readable. <\/p>\n\n\n\n<p><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>When thinking of a story I could use for this assignment, I thought back to children&rsquo;s stories and cartoons. Some notable cartoons came to mind, like Tom and Jerry and Looney Tune&rsquo;s Tweety Bird, and based off of these I decided to do a cat and mouse theme. The basic story I decided on using &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/11\/08\/project-10-sonic-story-10\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 10: Sonic Story&#8221;<\/span><\/a><\/p>\n","protected":false},"author":644,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[113,58,1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/68854"}],"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\/644"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=68854"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/68854\/revisions"}],"predecessor-version":[{"id":68870,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/68854\/revisions\/68870"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=68854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=68854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=68854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}