I added simple script functionality to one of my electric guitars. Simply click on the top volume knob to play an A power chord, the middle for a B power chord and the bottom for an E.
*** Sounds utilized from the public High Fidelity area.
Simple but want to get the ball rolling for some musical instrument playable scripts
(function(){
var _this = this;
this.playingSound = false;
this.sound = SoundCache.getSound("http://public.highfidelity.com/sounds/Guitars/Guitar%20-%20Metal%20E.raw");
this.clickDownOnEntity = function(entityID, mouseEvent) {
if (mouseEvent.button == "LEFT") {
if (!_this.playingSound || !_this.playingSound.isPlaying) {
_this.playingSound = Audio.playSound(_this.sound, {
position: Entities.getEntityProperties(entityID).position,
volume: 0.35,
loop: true
});
}
}
};
this.clickReleaseOnEntity = function(entityID, mouseEvent) {
if (mouseEvent.button == "LEFT") {
this.playingSound.stop();
this.playingSound = false;
}
};
})