Continuing the discussion from DynaLight (alpha ver) for punk.fx:
I’ve cleaned my code a bit and removed unnecessary parts.
The code linked below shows how to use FXLayer
s (a class that comes with punk.fx) to separate game objects from HUD, and apply effects to them independently from one another.
The FXLayer class extends Image
and lets you apply effects to entities by working as an additional layer on the screen.
So in this case we will have two FXLayers: a gameLayer
- to which we’ll add all the game entites (ship & background), and a hudLayer
- that will contain our HUD (including scores and what not).
After adding them to the world, changing the scale of the gameLayer
is as easy as modifying the scale
property of an Image (that’s because it actually IS an Image). All you have to do is
gameLayer.scale = 2.0;
and all the entities contained in it will be rendered at twice the size.
The code is commented, but assumes the reader to be familiar with FlashPunk and AS3 in general.
[code](https://dl.dropboxusercontent.com/u/32864004/dev/FPDemo/HUDZoomPixelate.zip) | [demo](https://dl.dropboxusercontent.com/u/32864004/dev/FPDemo/HUDZoomPixelate.swf)graphics credits go to the awesome art of Daniel Cook (there’s more on the site)