Intermediate xLIB Tutorial
Prerequisites: You've already read the beginner's tutuorial or teacher's approval
Now that you've gotten your feet wet and are comfortable xLIB, I will show you some more advanced (and useful) features.
Draw Rectangles and Lines:
xLIB has a feature that allows you to draw rectangles and lines between any two pixels.
Saving and Recalling pics:
Have you ever run out of pics? Been sick of only having 10 to work with? Are you tired of having to do:
Well, xLIB has the 2 functions for you. It allows you to store 255 pictures and recall them easily, even when the pics are archived! It's like magic!
Notes: Most of the time, you need to delete the pic before you store to it again
and also, when you look in your memory management, you will notice all sorts of funny names that are 767 bytes long. Don't worry. The TI-OS doesn't know what to call these extra pics, so it just picks something and sticks it on as a name.
Now, how do you recall those pics you've saved?
Now for a bit more complicated one.
Tile Map Generator:
What is a tile map, you ask? well, a tile map is a bunch of sprites drawn usually to resemble a map of some kind.
This is a tile map. Ignore the character, he was added on.
Now, you may be asking your self how one would make a tile map. Well, we do this by combining a pic and a matrix. Take your spritesheet and start counting sprites. The one in the upper right hand corner is 0. This is (usually) your "nothing here" sprite and is usually blank. Keep counting to the right 1,2,3,4,5,6,7,8,9,10.11 and when you hit the edge of your calc, jump down to the next row and start counting again from the left (12,13...). Now that you have your numbering down, you can start to make your Matrix. I would suggest a tilemap maker like PyroEditor to assist with this.
Here is the spritesheet that was used to make the tile map.
The creator wanted the wall in the upperlefthand corner so, in his matrix, at 1,1 (the first element) he put 2. He continued the wall all the way across the top. Then, he added the outside wall (3) on the next row.
He finished his tile map and stored it to [A]. Now, he was ready to use xLIB.
look at all those parameters
So, for that tilemap above, Matrix [A] looks like this:
And the spritesheet is in pic0 resulting in this
Whew. Pat yourself on the back if you understand that. It is one of xLIB's most powerful tools