Click Here To Go To The Your Computer Archive



Written By Keith Miles


Cover Art
Click Here To Enlarge Loading Screen

Loading Screen
Click Here To Enlarge Opening Screen

Opening Screen
Click Here To Enlarge Screenshot

Game Screenshot

Squares

Keith Miles with a Basic program for the BBC Micro that makes use of EOR printing and multicolour characters. This makes Squares shorter to type in and faster to play

Squares is a variation on an arcade game written by several software houses. The aim of Squares is to guide your boot around the grid, colouring each line and square traversed. The values shown in the squares are added to your score as they are made. To make it interesting a monster is pursuing you. This creature will erase all lines you have coloured that do not form a part of a square. There are also immobile monsters that periodically jump to new locations which you should be careful not to run into. As you proceed to higher levels the number of these latter monsters increases as does the frequency of their movements.

The particular features of this game that make it different from most games previously written in Basic is that it makes extensive use of Exclusive Or - EOR - colour printing and multicolour characters.

Shorter And Faster

When printing at the Graphics Cursor - VDU 5 - it is possible to superimpose defined or any other characgers on top of each other. Using different colours for the different features of the character to be created, the character is assembled by moving the cursor to the required location and successively selecting the foreground colour of the part of the character to be printed, printing it and moving the cursor back over the character.

In Basic this would take the form:

VDU5:MOVE X,Y:GCOL3,Y1:PRINT CHR$(X1):VDU8:GCOL3,Y2:PRINT CHR$(X2)

etc., where X,Y are the desired screen co-ordinates, Y1 the colour of character X1 and Y2 the colour of character X2. The VDU commands cause printing to take place at the graphics cursor and move the cursor one space left respectively. The man, squares and walls in the game are constructed on this way. These commands can all be replaced and strung together as VDU commands e.g., MOVE is VDU25,4,X;Y; GCOLVDU18,3,YI and PRINT is simply VDUX2. For example, the above line of- Basic would now read:

VDU5,25,4,X;Y;1B,3,Y1,X1,8,18,3,Y2,X2

Not only is this shorter but it executes faster. This is very important for the more complicated a character is the longer it takes to print and the slower movement will be.

EOR printing is important when coloured characters are to be moved. Refer to the User Guide for a detailed explanation, but when printing graphics characters, the colour is chosen with GCOL x,y where function x determines how colour y will be printed. x can have five values 0,1,2,3,4 which respectively print the colour, OR it with the colour already there, AND it with the colour already there, EOR it, etc and Invert it, etc. EOR (3) is used because it is possible to predict the outcome of function and by careful manipulation of the colour palette using VDU 19 to enable characters to move over other characters.

For example, Red - colour 1 - EORed with Blue - colour 4 - gives Magenta - colour 5 - if a red character is printed on top of a blue character, but if colour 5 is redefined to be red - VDU19,5,1,0,0,0 - that part of the red character over the blue character will show red not magenta. The EOR values needed are mathematically derived but can be easily found by using the BBC's own EOR function - type 1 EOR 4 to check the above example.

The game itself consists of a series of linked procedures which are called from within a REPEAT UNTIL loop which controls the game.

lvl% - level
bootx% and monsterx% - horizontal position
booty% and monstery% - vertical position
right% and HORZ% - 0 or 1, moving right or left
Down% and VERT% - 0 or 1, moving up or down
colour% and COLOR% - colour of line traversed
col% and COL% - colour of line coloured
(oldx%,oldy%,OLDX%,OLDY%) - starting coordinates of move
(hor%,ver%,HOR%,VER%) - destination coordinates of move
linedown% and lineacross% - positions on the grid stored as a decimal e.g. 27 = intersection, 2 across and 7 up
across% and down% - old horizontal and vertical location of monster
fill% - flag for number of squares filled
hit% - flag for identifying game over

Arrays

X%(-).Y%(-) - horizontal and vertical locations of grid intersections on Graphics grid.
sc%(X,Y) - square scores.
lineacross%(X,Y) - status horizontal lines (0 not traversed or wiped by monster, 1 traversed, 2 secure in a square)
linedown%(X,Y) - status of vertical lines.
MX(-),MY(-) - horizontal and vertical locations of still monsters.