Rig up some funky sounds
This commit is contained in:
parent
f95393a46e
commit
87bc40a52b
@ -122,6 +122,8 @@ class GeneratedShape {
|
|||||||
|
|
||||||
this.xDirection = 1;
|
this.xDirection = 1;
|
||||||
this.yDirection = 1;
|
this.yDirection = 1;
|
||||||
|
|
||||||
|
this.synth = new p5.MonoSynth();
|
||||||
}
|
}
|
||||||
|
|
||||||
collide(shapes) {
|
collide(shapes) {
|
||||||
@ -158,7 +160,12 @@ class GeneratedShape {
|
|||||||
/**
|
/**
|
||||||
* Play a sound after a collision is detected.
|
* Play a sound after a collision is detected.
|
||||||
**/
|
**/
|
||||||
return; // TODO: placeholder for now ...
|
var notes = ["G2", "C3", "G3"];
|
||||||
|
var duration = 0.8;
|
||||||
|
var time = 0;
|
||||||
|
var velocity = 0.5;
|
||||||
|
var index = random(0, notes.length + 1);
|
||||||
|
this.synth.play(notes[index], velocity, time, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
move() {
|
move() {
|
||||||
|
Loading…
Reference in New Issue
Block a user