0 Replies Latest reply on Sep 18, 2008 5:37 AM by Mike Bauer

    Sprites, coordinates, and width/height

    Mike Bauer
      Can someone help me understand my confusion about Sprites? I have been tinkering around with them, and they don't seem to always work like you would think they should.

      For instance, if I create a Sprite that makes a circle, and place it in the center of a Canvas, all is good. But, if I get the X/Y values of the circle, it doesn't tell me 350x250, I get back 0x0. Also, width seems to change if you move the object. So, if you create a circle with a diameter of 8 pixels, but you move it 80 pixels right, the width is now 88px.

      First off, is there a way to lock the coordinate system to the container the Sprite is in? I.E. if my Canvas is 300x600, tell the Sprite it's coordinate system is 0,0 to 300,600.

      Second, can you move a sprite without changing the width and height fields? I want to be able to move my 8 pixel wide circle and maintain a width/height of 8 no matter where it moves.

      Third, is there a common method in Sprite that people usually use to do refreshes? What would be nice is to be able to over ride a method that I can call from a Timer that moves the Sprite. Then I could just have an array of Sprites and loop through them once every Timer hit.

      Forth, is it more acceptable to have a single timer for the entire game, or a separate timer for each Sprite? I could see benefits both ways, but I am not sure how well the performance will be with hundreds of timers all running at once.