Scaling Sprites

It seems a bitmap is a property of a region
a region is a property of a sprite
drawscaledbitmap is a property of a screen

What is the simplest method of scaling a sprites bitmap? I want to scale some sprites to a fixed pixel width and then move them using sprite.moveto(x,y), but I’m not sure how to do this. I have sprites on screen, they are moving as I want them to, but I want to shrink em & keep em shrunk.

Anyone?

  • Joel

roBitmap, roRegion, and roScreen all implement the ifDraw2D interface, so you can DrawScaledObject to any one of them. If you want to scale a sprite permanently, then I’d probably draw it to a bitmap scaled, then use that bitmap throughout the rest of the app. The scaleblit.brs file in the Simple2D sample shows and example of how to do this.

Thanks for the suggestion, I got it working, the biggest issue being that the scaling factors are percentages, not pixels, so 0.50 instead of 50.0

  • Joel