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 VisualGameObject()
7 {
8 /** 9 The image that will be displayed by this object 10 @type Image 11 */ 12 this.image = null;
13 14 /** 15 Draws this element to the back buffer 16 @param dt Time in seconds since the last frame 17 */ 18 this.draw = function(/**Number*/ dt, /**CanvasRenderingContext2D*/ context, /**Number*/ xScroll, /**Number*/ yScroll)
19 {
20 context.drawImage(this.image, this.x - xScroll, this.y - yScroll);
21 }
22 23 /** 24 Initialises this object 25 @param image The image to be displayed 26 */ 27 this.startupVisualGameObject = function(/**Image*/ image, /**Number*/ x, /**Number*/ y, /**Number*/ z)
28 {
29 this.startupGameObject(x, y, z);
30 this.image = image;
31 return this;
32 }
33 34 /** 35 Clean this object up 36 */ 37 this.shutdownVisualGameObject = function()
38 {
39 this.shutdownGameObject();
40 }
41 }
42 VisualGameObject.prototype = new GameObject;
Top