Friday, May 6, 2011

The first program to place the shapes on the screen




Here is the Applesoft Basic program code I created to place the shapes on the screen in the correct order and placement.
On line 5 you can see the BLOAD command, which shows the name of the Shape Table.  I used ULTIMA1 for the name of my shape table, if you use something different then you need to change this name.
In this test I used a for-next loop to place all the shapes/Graphic Tiles on the screen but you will notice when you run this program that it is a slow process to place the tiles on the screen.  They get placed one at a time and slowly fill up the screen.  You could do this in the background while you have the HGR2 screen up, which is page two of the Hi-Res graphics mode.  The more I read, the more I am getting a better understanding of how these two graphic modes work together for moving graphics on the screen.  Can you say Animation boys and girls!!!
The way HGR2 works is you can be in page 1 HGR screen with a shape or image and in the background you could be drawing another image or shape in HGR2 page 2.  this way, you can switch between the two pages and get a clean animation from the two images or shapes!  Pretty cool!
In my program I am only using HGR page 1 and placing the shapes on the screen one by one as a test.  I am trying to figure out a way to get the shapes to move UP/DOWN/RIGHT/LEFT.  I know you use a GET command to check for Keystrokes and then move the shapes based on the key pressed but you can’t use a FOr-Next loop to move the shapes because it is too slow.  They would show up clunky and be placed on the screen one-by-one, which is not how you see it in the game.
The DATA in the 5000 lines are the SHAPE numbers for each row. Hence, you have 20 data values per line up to the 10 lines.  The DATA in lines 6000 are for the HCOLOR values of each shape.  You must have a color value assigned to each shape or it will show up wacky.  When you create a shape you assign a color value to it like white or blue or green or even white assorted.  This color value must be issued with the DRAW command or you get strange affect with the shape.  Also, you must start on an odd X value when drawing the shape because the shapes are assigned a 1 for the X value and if you start it on an even value you get the shape to shift and you get the next color shift in the shape.  I will explain this issue later in more detail.
Have fun with the program, if you have any questions please ask.
More to come later.

No comments:

Post a Comment