Refactor away from '== null' checks towards isSet

This commit is contained in:
2014-06-26 07:15:38 -07:00
parent e0f236c5c0
commit 5ac3159e38
4 changed files with 29 additions and 28 deletions

View File

@@ -29,8 +29,8 @@ SoundSprite.prototype = Object.create(Phaser.Sprite.prototype);
SoundSprite.prototype.constructor = Light;
SoundSprite.prototype.update_new_values = function() {
if ( this.sound_key == null ) {
if ( this.sound !== null ) {
if ( isSet(this.sound_key) == false ) {
if ( isSet(this.sound) ) {
this.sound.stop();
}
return;
@@ -42,7 +42,7 @@ SoundSprite.prototype.update_new_values = function() {
this.sound_forcerestart = parseBoolean(this.sound_forcerestart);
this.sound_nofade = parseBoolean(this.sound_nofade);
if ( this.sound !== null )
if ( isSet(this.sound) )
this.sound.stop();
this.sound = game.add.audio(this.sound_key, this.sound_volume, this.sound_loop);
this.sound.play(