var EHDI = EHDI || Object.create(null); EHDI.GAME = EHDI.GAME || Object.create(null); EHDI.GAME.components = EHDI.GAME.components || Object.create(null); //objName can be omitted if you want to get random object EHDI.GAME.components.StationaryObject = function(objName) { var texture, obj; if(objName == undefined) obj = EHDI.GAME.SpriteManager.getRandomSprite(EHDI.GAME.SpriteManager.objectSpriteList); else obj = EHDI.GAME.SpriteManager.getSpriteName(EHDI.GAME.SpriteManager.objectSpriteList, objName); texture = obj.default; EHDI.GAME.components.GameObject.call(this, texture); this.defaultSprite = obj.default; this.lightedSprite = obj.lighted; this.lighted = false; } EHDI.GAME.components.StationaryObject.prototype = Object.create(EHDI.GAME.components.GameObject.prototype); EHDI.GAME.components.StationaryObject.prototype.update = function() { } EHDI.GAME.components.StationaryObject.prototype.setLighted = function(val) { if(val) { this.texture = this.lightedSprite; this.lighted = true; } else { this.texture = this.defaultSprite; this.lighted = false; } }