Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts

    CANVAS not drawing my programmable Sprite

    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.

    PHP Code:
    this.draw = function(){
            
    //this.updateParams();
            
    var context this._canvas.getContext("2d");
            
    context.beginPath();
            
    context.fillRect98981);
            
    context.fillStyle "#000000";
            
    context.fill();
            
    context.closePath();
        } 
    Was putting the width and height and the location in the wrong order (DURRRR)
    Last edited by barkermn01; 06-30-2011 at 05:13 PM.
    Working towards a Internet where we don't have website just browser applications Kill the Hyper-link and say hello to 3D Games in the browser :)


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •