Update cat.js

hook into isPlaying for sounds
This commit is contained in:
James B. Pollack 2015-10-01 18:34:22 -07:00
parent 3565d96ffb
commit 6cc2df9052

View file

@ -21,29 +21,36 @@
Cat.prototype = {
isMeowing:false,
this.injector:null,
startTouch: function() {
var _ t=this;
if(this.isMeowing!==true){
this.meow();
this.isMeowing=true;
Script.setTimeout(function(){
_t.isMeowing=false;
},2000)
}
},
update:function(){
if(this.injector!==null){
this.isMeowing = this.injector.isPlaying;
}
if(this.isMeowing===false){
this.injector=null
}
}
meow: function() {
Audio.playSound(this.meowSound, {
this.injector = Audio.playSound(this.meowSound, {
position: this.position,
volume: .1
volume: 0.1
});
},
preload: function(entityID) {
this.entityID = entityID;
this.position = Entities.getEntityProperties(this.entityID, "position").position;
Script.update.connect(this.update);
},
unload: function() {