summaryrefslogtreecommitdiff
path: root/static/tests/canvas2/jsplatformer5_files/GameObject.js
diff options
context:
space:
mode:
authorScott Ostler <scottbot9000@gmail.com>2010-06-17 02:47:52 -0400
committerScott Ostler <scottbot9000@gmail.com>2010-06-17 02:47:52 -0400
commit437c7cd3ecff287a3aec3a0b08c850092c67e8dd (patch)
treef4819b4ba2d43a47a82125e21e32fca8f720b1cc /static/tests/canvas2/jsplatformer5_files/GameObject.js
parentc47183393b9271c05e7c947340c499bda7ef0bda (diff)
parent0a4fdca2e4070771eec03c43bf99100fd09e5543 (diff)
Merge branch 'master' of ssh://dump.fm/pichat/repo
Diffstat (limited to 'static/tests/canvas2/jsplatformer5_files/GameObject.js')
-rw-r--r--static/tests/canvas2/jsplatformer5_files/GameObject.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/static/tests/canvas2/jsplatformer5_files/GameObject.js b/static/tests/canvas2/jsplatformer5_files/GameObject.js
new file mode 100644
index 0000000..e6e4e09
--- /dev/null
+++ b/static/tests/canvas2/jsplatformer5_files/GameObject.js
@@ -0,0 +1,46 @@
+/**
+ The base class for all elements that appear in the game.
+ @author <a href="mailto:matthewcasperson@gmail.com">Matthew Casperson</a>
+ @class
+*/
+function GameObject()
+{
+ /** Display depth order. A smaller zOrder means the element is rendered first, and therefor
+ in the background.
+ @type Number
+ */
+ this.zOrder = 0;
+ /**
+ The position on the X axis
+ @type Number
+ */
+ this.x = 0;
+ /**
+ The position on the Y axis
+ @type Number
+ */
+ this.y = 0;
+
+ /**
+ Initialises the object, and adds it to the list of objects held by the GameObjectManager.
+ @param x The position on the X axis
+ @param y The position on the Y axis
+ @param z The z order of the element (elements in the background have a lower z value)
+ */
+ this.startupGameObject = function(/**Number*/ x, /**Number*/ y, /**Number*/ z)
+ {
+ this.zOrder = z;
+ this.x = x;
+ this.y = y;
+ g_GameObjectManager.addGameObject(this);
+ return this;
+ }
+
+ /**
+ Cleans up the object, and removes it from the list of objects held by the GameObjectManager.
+ */
+ this.shutdownGameObject = function()
+ {
+ g_GameObjectManager.removeGameObject(this);
+ }
+}