PixelBlitz Engine Update

Another day, another update 🙂 I just pushed my latest changes to the PixelBlitz Engine into svn. Each day it becomes something closer to something you could use to write a decent game with!

Today was mostly boring but important tasks. You can now set the registration point (hot spot) of any PixelSprite object. This works in exactly the same way as setting the registration point of a MovieClip in the Flash IDE, except you do it via one line of code.

There are 9 pre-defined locations (such as top-left, center and bottom-middle), but you can also set any x/y hotspot value you wish (of any size). The hotspot can be updated in real-time, and the renderer takes account of this immediately. If you scale the object it automatically scales the hot spot as well, thus keeping it perfectly aligned.

The term “hot spot” comes from the STOS/AMOS world, where it served the exact same purpose.

PixelSprites will now center themselves upon creation, but you can over-ride this with a single function call. I updated the getDistance() method so it will now report the distance between either the hot spots of two objects, or their x/y values (i.e. top left-hand corners).

Other new additions include:

Scale – PixelSprites can now be scaled in exactly the same way as you’d scale a Bitmap / Sprite.

Alpha – Set (or get) the alpha value of any PixelSprite, in the same way you would on a Bitmap / Sprite.

Smoothing – if you scale the object you can now control if it’s smoothed (or not) during the process.

Tint – you can now tint your PixelSprites! You specify the red, green and blue amounts, but you can also set the overal tint intensity (meaning you can do a full red tint at 50%, so instead of your object turning out completely red in colour, it looks like a proper 50% alphad red tint has been applied.

I also updated the in-line documentation and fixed a bug in the renderer where it would still render an object who’s alpha value was set to zero. Now it doesn’t waste time doing that 🙂

Check out the latest version from Google Code:

svn checkout http://pixelblitz.googlecode.com/svn/trunk/ pixelblitz-read-only

Posted on August 29th 2008 at 12:03 am by .
View more posts in PixelBlitz. Follow responses via the RSS 2.0 feed.

Make yourself heard