From e890d6d91db6d716beeb22c94d6bf0a9d88f1ef5 Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Thu, 17 Jun 2010 00:34:02 -0400 Subject: sostler prod commit --- .../jsplatformer5_files/VisualGameObject.js | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 static/tests/canvas1/jsplatformer5_files/VisualGameObject.js (limited to 'static/tests/canvas1/jsplatformer5_files/VisualGameObject.js') 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 Matthew Casperson + @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; -- cgit v1.2.3-70-g09d2