Classic Computer Magazine Archive ANTIC VOL. 7, NO. 1 / MAY 1988

Crazy Chicken Chicken Barrage

Watch out for the eggs, grenades and knives!

By STEPHEN EVERMAN & PAUL PRATT

Ever want to just chuck it all and get a chicken farm? Well, you'll change your mind after playing Crazy Chicken Barrage, because this farm is out to get you! The game runs in low resolution and a color monitor is required.

High in their roosts above the barnyard, your hens produce egg after egg--and then they toss them down without a second thought. If you don't want to go broke, you must catch each egg before it splats on the ground. To make things even worse: You're stuck with war surplus chickens--a rare breed that lays hand grenades and knives as well as eggs. It's almost as if the chickens want to make sure that you "buy the farm" in more ways than one.

But you do have four lives and your profits are stored as points on the disk, so your heirs can remember you fondly.

GETTING STARTED

Using Michtron's GFA BASIC, carefully type-in BARRAGE.BAS and Save a copy before you Run it. Antic Disk users who do not own GFA Basic will find a ready-to-run version of the program, BARRAGE.PRG, on the back of the monthly disk--along with a Help file explaining how to transfer the program to an ST disk.

To start playing Barrage, click on PLAY. The farm boy onscreen jumps into egg-catching position and the action begins.

Moving your mouse left and right moves the farm boy accordingly. Help him grab those eggs before they splat. That's tough enough, and it gets tougher. You start off with one egg, but eventually you'll have to juggle four at a time. Then just when you think you've gotten the hang of that, there'll be something even tougher to content with--another round.

There is no limit to the number of rounds you can play, and as the game proceeds, the eggs fall at different angles and speeds. They might become grenades that explode if they hit the ground, or knives that kill if you catch them (so let them drop!). And everything keeps falling faster and faster.

When you just can't take the pressure anymore, flee to the entry screen clicking the mouse. When you're ready, click on PLAY again and you'll return to the round you left.

When your feathered friends finally do you in, your score is saved to disk if it's higher than previous high score. And if there isn't a high score file on the disk, the program will create one.

PROGRAM NOTES

The first thing we do after checking the resolution with an Xbios function is to store the screen memory address in the variable Scr_mem by LPEEKing address 1102.

Next, the Fix-colors() subroutine saves the user's current color palette in the Pal array. Few things are as annoying as a program which colors your screen with arcade-like hues, then neglects to restore your original screen colors.

Fix-colors is a simple routine which may be used to save a user's palette at the start of a program, and restore it at the end. Use the statement Fix_colors(True) to save the original palette, and Fix_colors(False) to restore it.

We then Gosub to In_hi_score and get the high score from the disk. If there isn't a HI_SCORE.EGG file, we'll be routed to the procedure that creates one.

Now we take Scr_mem down to Assign_objects, where we change the data at the end of the program into objects.

The Get command stores a piece of the screen as a string which can be put back onscreen with the Put command. We'll use the Get command to store our objects in arrays. For example the Egg, Grenade and Knife are all stored in an array called Egg$.

Egg$(0)=Egg
Egg$(1)=Splattered Egg
Egg$(2)=Hand Grenade
Egg$(5)=Knife

Assign_objects first creates three erasers (by getting three pieces of blank screen) that erase the boy, egg and score respectively. Then all 16 of the screen colors are set to the same color so when we begin Poking our data into screen memory, we won't see it happening. Once all the colors are the same, we begin pumping out data onto the screen and catching the objects in arrays until we've created the pictures we're going to use.

Here's how we get the three boy icons (walking left, walking right and middle) into their arrays: The outer loop "For Boys = 1 to 3" says to create all three boys the same way. It is the inner loop "For X = 0 to 30" that can be tricky. This loop gets the data from the Data statements and draws the boys in the upper left corner of the screen, so we can capture them into arrays with the Get command.

SCREEN MEMORY

Scr_mem can also be considered the beginning of the first 16 pixels of screen memory. Unfortunately we need four color planes of 16 bits each to create the first 16 pixels on the screen, so the first 64 bits of screen memory are all dedicated to the first 16 pixels of screen memory. That is, for every 16 pixels across the screen, we have to Poke four words of data.

The loop names these four words Plane1, Plane2, Plane3 and Plane4. We then Poke them directly into the upper left corner of screen memory. But our boy is only one word wide, so we aren't interested in the second set of 16 pixels in screen memory. We are interested in the 16 pixels directly below the first 16, So we multiply X by 160-the number of bytes across the screen-to get the screen memory address where the second set of 16 pixels begins.

Once all of our objects are safely tucked away in arrays, we return to the beginning of the program and set up the eggs' characteristics for the first round. We'll run them through a loop that accesses the New_egg subroutine using the command @New_egg(Numegg).

An egg's characteristics include its X-Y position, speed of descent and whether it falls sleight or at an angle. In fact, an egg can be "not an egg at all", but a hand grenade or knife. The procedure New_egg always makes a new object an egg that drops straight down. Then it accesses the subroutine according to the level you're on: if you were on level 5, the program would Gosub to Procedure Lev5.

This would send you to Procedure Grenade to see if the egg should be turned into a grenade, and then the speed of the falling egg is set randomly. The characteristics of an egg are kept in arrays whose reference number is the number of that falling object.

Let's skip down to Procedure Main. First, let's make sure the falling object has characteristics with a Gosub New_egg(1). The While loop circles until we push a mouse button and the variable Play becomes false.

Now let's dispose of the three If/Endif segments of the procedure. The first simply checks to see if a button is pressed. Then it removes all the falling objects from the screen, makes the boy dance, and leaves Main. The second If Dance=True does a Gosub to Dance. The If steady>4 statement puts a standing boy on the screen at the X position of your mouse after five cycles through Main.

CAUTION: FALLING EGG

Procedure Egg_drop sets the falling object to the first object, array number 0. Then a Repeat/until loop is set up to cycle until all of the falling objects that are suppose to be on the screen have been drawn.

The first three lines after Repeat erase the old object, add its vertical offset (or speed) to its vertical position and print the object. Once the object is Put on the screen, we wait for the next vertical blank with the command Vsync, then add the object's horizontal movement to the X position to prepare for the next movement.

The rest of the routine is a series of nested If statements that check to see what happens to the object we just drew.

The Difficulty procedure takes care of all bookkeeping for the program. It changes the levels, keeps track of the number of fallen eggs and awards bonuses. The first thing it does is Decrement Eggs_available, which is the number of objects that must fall before we add another falling object.

The Walk procedure makes sure that the X position of your mouse is in bounds and that you have moved the mouse. If so, the procedure then checks to see which direction the mouse is going in--whether the new position is larger or smaller then the proceeding position.

If the position is larger, we set the variable Obj to 3, and if it's smaller, the variable is set to 2. The left-walking boy is Obj$(3) and the right-walking boy is Obj$(2). So by replacing the number with the variable, we automatically switch to the corrected picture.

Paul Pratt and Stephen Everman published Maze Master and Pascal Towers in the March 1988 Antic and BASIC Concentration in April 1988.

Listing  BARRAGE.BAS Download

On disk  BARRAGE.PRG Download