View Full Version : Resolved CANVAS not drawing my programmable Sprite

06-30-2011, 05:02 PM
I have a Canvas controller Class and a new Sprite Controller class

Please note I'm not using GIF sprites these are proper programmable sprites like you get in C game engines

So i have a Class that controls my Canvas and the Drawing of my Canvas what i mean by this is if you call a new instance of my Class it will create a new Canvas if you already have a canvas you can get a JSRenderEng Object from your Canvas id

Now my problem lies with getting my sprites to draw them self's currently my sprites can only appear in one place

in a 100x100 px canvas they load as 98x98 1top 1left so they should be a perfect mathematical square inside the canvas with a 1px border, for some reason its not drawing

But here is an explination about the classes

The Canvas handles the start of the drawing events by going though the sprites attached to the canvas and then calls there draw method,

However i seam to have a problem with this my draw method is being fired but is not rendering on the canvas can any one spot the problem.

this.draw = function(){
var context = this._canvas.getContext("2d");
context.fillRect( 98, 98, 1, 1 );
context.fillStyle = "#000000";

Was putting the width and height and the location in the wrong order (DURRRR)