blob: 3f3329a334cdd89f240a5c316948c2640a949119 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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;
|