diff options
| author | Scott Ostler <scottbot9000@gmail.com> | 2010-06-17 02:47:52 -0400 |
|---|---|---|
| committer | Scott Ostler <scottbot9000@gmail.com> | 2010-06-17 02:47:52 -0400 |
| commit | 437c7cd3ecff287a3aec3a0b08c850092c67e8dd (patch) | |
| tree | f4819b4ba2d43a47a82125e21e32fca8f720b1cc /static/tests/canvas1/jsplatformer5_files/VisualGameObject.js | |
| parent | c47183393b9271c05e7c947340c499bda7ef0bda (diff) | |
| parent | 0a4fdca2e4070771eec03c43bf99100fd09e5543 (diff) | |
Merge branch 'master' of ssh://dump.fm/pichat/repo
Diffstat (limited to 'static/tests/canvas1/jsplatformer5_files/VisualGameObject.js')
| -rw-r--r-- | static/tests/canvas1/jsplatformer5_files/VisualGameObject.js | 49 |
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; |
