by Frank Force
PXL-ON() VS PT-ON()
Basically for games, you're going to want to use Pxl-On(). This is because Pxl-On() is significantly faster then Pt-On(). NEVER USE PT-ON, IT'S SLOWER! Also, Pxl-On() has the added advantage of Pxl-Test(), which is very useful. Pxl-Test() will tell if a given pixel is on or off; 1 for on, 2 for off. For example, to check when the ball hit the wall in Breakout, I used Pxl-Test().
OK, this is where the trouble starts. Line works more like Pt-On() then Pxl-On(). There's a formula that I use to convert it. It goes like this...
:0 -> Xmin
:94 -> Xmax
:-62 -> Ymin
:0 -> Ymax
That part must appear at the beginning of the program in it's exact form. Then, if this program displays the endpoints...
This will be how to draw a line between them...
:Line(B, -A, D, -C
Notice how A and B are switched, C and D are switched, and A and C are negative. Of course you don't have to display the endpoints first, I just thought it was easier to explain that way.
There's no way to draw filled in circles, so here's a good algorithm that I use. I think there's a name for it, but I forget it. You probably shouldn't use a subprogram for this because it's pretty small and it usually wont come up during normal program flow. R is the radius, A and B are the coordinates. It also uses X, temporarily.
For(X, 0, R
square rout (R^2 - X^2
Line(A - X, Ans - B, A - X, -Ans - B
Line(A + X, Ans - B, A + X, -Ans - B
A Pre-Drawn Background is a screen that you prepared in advance and stored into a picture. I used one in Breakout 2 and Pipe Dream, both should have been reviewed in this issue. Using Pre-drawn backgrounds are really a matter of personal preference. I like them, because they can be made very detailed, and appear instantly on command. Some people don't like them because they use up a picture, but I think it's worth it.
Last month, I received some mail on using goto to bypass Ifs if certain conditions aren't met (see last column). My rule still applies here, don't use goto because it leads to slowdown and memory errors. That about wraps it up. Remember, next month I'm relying on your questions, don't let me down.