Monday, June 06, 2011

Tinting in ImpactJS, Part 3

So, it seems that some people are reading this blog. Which is nice.

Recently, I was asked to come up with an example for usage of my ImpactJs tinting plugin (downloadable here).

Well the first prerequisite for usage is to own ImpactJS, which is purchasable from here. When you have this installed and configured correctly, then you can drop the imageTinter.js into the ImpactJS plugins directory.

Once this is done, make sure you add 'plugins.imageTinter' to the requirements section of your main game class.

From there, you will be able to use various overloaded forms of the init method for ig.AnimationSheet and ig.Image that allow you to specify a tint color and tint alpha. Support is also provided for tinting a background map using setLayerTint method of the ig.BackgroundMap class.

Note: As long as any new images are instantiated as part of the init methods of the respective owning classes (rather than instantiated prior to the init method) then the images should be stored in the ImpactJS-provided image cache using a tint-friendly key format.

There is still some manual plumbing that needs to be done by the developer to fully integrate the tinting into ImpactJS, but this should certainly be enough to get started.
Post a Comment