Game Development Reference
In-Depth Information
filters.pop();
}
filters.push(filter);
s.filters = filters;
}
}
}
Cutting up assets
A typical game contains a plethora of art assets numbering in the hundreds for
medium-sized games. One obvious way is to have an image file for each, but just
managing such a huge number of files may become cumbersome.
One trick is to put more than just one asset into a single .jpg or .png file. The assets
in a single file are shown as follows:
Now, how do we make it useable in the game? Do we need to cut up the asset file
and then use them? Exactly! How do we do that?
There are essentially three steps:
1. Load the graphics file as a BitmapAssetData object.
2.
For each asset you want to cut out, create a bitmap data by providing the
specific x and y (top left) and width and height.
3.
Create the sprite from the cut out bitmap data.
 
Search WWH ::




Custom Search