1 /** 2 The base class for all elements that appear in the game. 3 @author <a href="mailto:matthewcasperson@gmail.com">Matthew Casperson</a> 4 @class 5 */ 6 function GameObject() 7 { 8 /** Display depth order. A smaller zOrder means the element is rendered first, and therefor 9 in the background. 10 @type Number 11 */ 12 this.zOrder = 0; 13 /** 14 The position on the X axis 15 @type Number 16 */ 17 this.x = 0; 18 /** 19 The position on the Y axis 20 @type Number 21 */ 22 this.y = 0; 23 24 /** 25 Initialises the object, and adds it to the list of objects held by the GameObjectManager. 26 @param x The position on the X axis 27 @param y The position on the Y axis 28 @param z The z order of the element (elements in the background have a lower z value) 29 */ 30 this.startupGameObject = function(/**Number*/ x, /**Number*/ y, /**Number*/ z) 31 { 32 this.zOrder = z; 33 this.x = x; 34 this.y = y; 35 g_GameObjectManager.addGameObject(this); 36 return this; 37 } 38 39 /** 40 Cleans up the object, and removes it from the list of objects held by the GameObjectManager. 41 */ 42 this.shutdownGameObject = function() 43 { 44 g_GameObjectManager.removeGameObject(this); 45 } 46 }