var ScaleModes = require('../renderer/ScaleModes'); var Component = require('../components'); var GameObject = function (state, x, y, texture, frame, parent){ this.state = state; this.game = state.sys.game; this.name = ''; this.type = 0; this.parent = parent; this.texture = texture; this.frame = frame; this.transform = new Component.Transform(this); this.transform.positionX = x; this.transform.positionY = y; this.data = new Component.Data(this); this.color = new Component.Color(this); this.scaleMode = ScaleModes.DEFAULT; this.skipRender = false ; this.visible = true ; this.children = null ; this.exists = true ; } ; GameObject.prototype.constructor = GameObject; GameObject.prototype = { preUpdate: function (){ } , update: function (){ } , postUpdate: function (){ } , render: function (){ } , destroy: function (){ } } ; Object.defineProperties(GameObject.prototype, { x: { enumerable: true , get: function (){ return this.transform.positionX; } , set: function (value){ this.transform.positionX = value; } } , y: { enumerable: true , get: function (){ return this.transform.positionY; } , set: function (value){ this.transform.positionY = value; } } , alpha: { enumerable: true , get: function (){ return this.color._alpha; } , set: function (value){ this.color.alpha = value; } } , blendMode: { enumerable: true , get: function (){ return this.color._blendMode; } , set: function (value){ this.color.blendMode = value; } } } ); module.exports = GameObject;