Classic Computer Magazine Archive COMPUTE! ISSUE 39 / AUGUST 1983 / PAGE 100

BLOCKHEAD

Matt Giwer

The blockhead moves vertically, bouncing as he goes, and tries to pop the floating balloons. You must catch him as he comes down, but his wildly erratic movements make that very difficult. Versions for 64 and Atari - requires paddles.

"Blockhead" is similar to some of the early arcade games. You will need a paddle in position one to play. The knob controls the position, and the trigger bounces the blockhead. The objective is to pop the balloons and catch the blockhead when he comes back down. When the blockhead hits the balloons, there will be an explosion; he will be bounced around, hitting more balloons.

After you clear one screen of balloons, you will get a new set and advance to the next level of play. At each advancing level the blockhead moves more wildly as he comes down. More balloons will be punctured, but there is also a greater chance either of missing him or of his being thrown outside the area of play. There are five blockheads per game. When you miss the last one, you will be given the opportunity for a new game.

Subroutine Strategy

Although Blockhead seems like a simple game, there is more involved than might first be imagined. Let's take a look at the game logistics in the Atari version. The blockhead must move up and down. A calculated trajectory would slow down the game considerably, so the vertical motions are stored in strings, BU$ and BD$. The numbers in these strings, in groups of three, are the vertical positions that use VAL(BU$(x,x + 2)) POKEd into PLY, which is the vertical position of the blockhead. Blockhead is Player 0 of the P/M graphics.

Since activities such as scoring are sometimes required to be called out of the normal game sequence, this is a subroutine-oriented program. For example, when the last blockhead is missed, the game goes to the subroutine at line 6000. The number of balloons broken still has to be counted, so the subroutine SCORE is called here also. At line 1910, the start of the first game, or at line 6030, the start of a new game, the program waits for a trigger pull by calling the subroutine TRGR. But when it goes to a new level, line 5840, there is no need to wait for a trigger pull, so it is not called. Line 2175 sets up a new game, but only after the player has agreed by pulling the trigger as called in line 6030.

The rest of the game is straightforward. The P/M graphics are set up starting at line 30000. From this line on, REMs are used to indicate significant routines, statements, or definitions. The Vertical Blank Interrupt routine defines player movement. The definition of each player is also noted by REMs.

The lines discussed below are of special interest.

Lines 5012 and 5512 evaluate the BU$ and BD$ to determine the vertical positions.

Line 5109 determines the horizontal position of the blockhead with respect to the position of the graphics.

Lines 5110-5114 pop balloons two or four at a time depending on the size of the player. The eight bits of the player control eight color clocks, while the eight bits'of a character in GRAPHICS 0 control only half-color clocks. The result is that eight bits in P/M graphics are twice as wide as eight bits in normal graphics.

Line 5810 calls the machine language string written in line 51. This routine reads the top lines of the screen and counts the number of occurrences of the CTRL T "balloons" at the top of the screen. The 23rd character in this string, the uppercase T, determines which character is searched for. To search for a different character, the T must be replaced. First look at Table 9.6 (p. 55) of the Atari BASIC Reference Manual and find the number of the character you want to search for. Then look at Appendix C and find the ATASCII character for that number, and substitute the ATASCII character for the T. This machine language string works for only the first 256 locations on the screen, or for about six and one-half lines.

Note the POKE PLX + 1, PADDLE(0) used in most subroutines. This is the catching platform; you are asked to update its position whenever possible. This is required so the platform won't end up off of the screen as you turn the knob.

In "Blockhead," the figure bounces to the top of the screen to pop balloons – Atari version.

Notes For 64 Version Of Blockhead

Gregg Peele, Programming Assistant

The balloons in the 64 version of "Blockhead" float across the screen.

The Commodore 64 version of "Blockhead" utilizes the eight available sprites and an interrupt-driven routine which continues running even when the BASIC program is stopped. Using this machine language routine provides for optimal motion within the game and provides a means to constantly monitor the position of the sprites and set or unset the most significant bit of each sprite depending on which side of the "seam" the sprite is on.

This game works using a timer. The object of the game is to "pop" the balloons as they float across the sky. The more balloons that you pop within your time limit, the more points you receive. Not only must you continually attempt to pop balloons, but you must also catch the blockhead before he falls below his home base. If you miss catching him, points are deducted until you can bring him back to the surface (using the fire button).

The original version of this game is written to be used with Atari-style paddles. If you have Commodore paddles, you must change lines 1070 and 1080 to read as follows:

1070 DATA 216,24,173,164,194,105,28,141
1080 DATA 161,194,56,173,164,194,233,217

This alteration leaves a slight glitch in the paddle movement around the seam but provides for optimal range for movement around the screen.

Blockhead utilizes the collision register to detect when one sprite "touches" another sprite. Since the collision register is changed only temporarily when sprites collide, the contents representing the collision must be saved until an event occurs which may again make the sprite collide with another sprite. The stored register is then cleared and the sprite is again ready for collision. Collision detection between the blockhead and the balloons is handled through BASIC. Since BASIC runs at a relatively slow rate, the blockhead must hit the balloon squarely to initiate a collision. A glancing blow will not generally "pop" a balloon.