summaryrefslogtreecommitdiff
path: root/static/tests/canvas1/jsplatformer5_files/VisualGameObject.js
diff options
context:
space:
mode:
authordumpfmprod <dumpfmprod@ubuntu.(none)>2010-06-17 00:34:02 -0400
committerdumpfmprod <dumpfmprod@ubuntu.(none)>2010-06-17 00:34:02 -0400
commite890d6d91db6d716beeb22c94d6bf0a9d88f1ef5 (patch)
tree9891d77bbfaa7459783605b29906d3aa06ba5801 /static/tests/canvas1/jsplatformer5_files/VisualGameObject.js
parentf43aa915a5b5268b7b05e2a3f15d128ee218ade5 (diff)
sostler prod commit
Diffstat (limited to 'static/tests/canvas1/jsplatformer5_files/VisualGameObject.js')
-rw-r--r--static/tests/canvas1/jsplatformer5_files/VisualGameObject.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/static/tests/canvas1/jsplatformer5_files/VisualGameObject.js b/static/tests/canvas1/jsplatformer5_files/VisualGameObject.js
new file mode 100644
index 0000000..3f3329a
--- /dev/null
+++ b/static/tests/canvas1/jsplatformer5_files/VisualGameObject.js
@@ -0,0 +1,49 @@
+/**
+ The base class for all elements that appear in the game.
+ @author <a href="mailto:matthewcasperson@gmail.com">Matthew Casperson</a>
+ @class
+*/
+function VisualGameObject()
+{
+ /**
+ The image that will be displayed by this object
+ @type Image
+ */
+ this.image = null;
+
+ /**
+ Draws this element to the back buffer
+ @param dt Time in seconds since the last frame
+ @param context The context to draw to
+ @param xScroll The global scrolling value of the x axis
+ @param yScroll The global scrolling value of the y axis
+ */
+ this.draw = function(/**Number*/ dt, /**CanvasRenderingContext2D*/ context, /**Number*/ xScroll, /**Number*/
+yScroll)
+ {
+ context.drawImage(this.image, this.x - xScroll, this.y - yScroll);
+ }
+
+ /**
+ Initialises this object
+ @param image The image to be displayed
+ @param x The position on the X axis
+ @param y The position on the Y axis
+ @param z The depth
+ */
+ this.startupVisualGameObject = function(/**Image*/ image, /**Number*/ x, /**Number*/ y, /**Number*/ z)
+ {
+ this.startupGameObject(x, y, z);
+ this.image = image;
+ return this;
+ }
+
+ /**
+ Clean this object up
+ */
+ this.shutdownVisualGameObject = function()
+ {
+ this.shutdownGameObject();
+ }
+}
+VisualGameObject.prototype = new GameObject;