★ AMSTRAD CPC ★ GAMESLIST ★ DOGFIGHT (c) AMSTRAD COMPUTER USER ★ |
Amstrad Computer User |
Be a World War I flying ace with Alex Martin's simulation Dogfight involves piloting a WWI fighter against the evil Blue Baron. You must manoeuvre your plane behind him to get a clear shot. Five hits from your machine gun is enough to destroy the aircraft. Ten Blue Barons must be shot down to win the game. Basic and machine code are used, the Basic part loading a binary file containing sprite routines and data. This is then Called to "log on" the RSXs, Sprite and Blank. These extensions are then used in the main Basic program to draw and erase the aircraft. RSXs are preceded by a " symbol. This is put into the program by '. Typing in Type in Listing I, the Basic part of the game, and save it on to a tape or disc. Reset and type in Listing II, the Basic program that creates the binary file. Save Listing II on to a separate tape in case of accidents. Run Listing II. If all is ok, the program will want to save the binary file. If you are using tape, save the file on the same tape as the Basic part of the game so that it loads when the game is run. When the game is running correctly Listing II can be deleted. Make sure you do not type Is instead of Is in variable names. And save your work before attempting to run the program. How it works Lines 10 to 130 set up the program. First all variables are set to integers and then a break interrupt is set up that will put the computer into Mode 2 when Esc is pressed. Line 40 is the first important line. It sets up three functions which allow the coordinates of the planes to be incremented and decremented without worrying that the new coordinate is off the screen. Line 50 sets up the screen with a graphics window. This stops the score from being shot down. Line 60 loads and calls the machine code if it hasn't been loaded already. 70, 80 and 90 set up the ink colours and the keynumbers. In line 100 diff, as already mentioned, is the level of difficulty and d is the distance between each dot when the guns are fired. 110 to 130 sets up the sound envelopes and moves to the routine at 1170. Lines 1170 to 1220 deal with the two-player option. First the various messages are printed and then a loop between 1190 and 1220 is entered. Only when either 1 or 2 has been pressed can the loop be exited. The routine sets up the variable twoplayer to be either true (1) or false (0) and this is used to control the program later on. After leaving the routine, control is passed to line 1070. Line 1070 clears the screen and prints the score by calling the routine at 1130. It then enters the main loop at 170. Lines 170 and 180 set up the variables ready for starting a dogfight. The x and y coordinates of the planes are set up and the damage is zeroed. Line 190 makes engine drone noises according to how far up the screen the planes are. At line 200 the twoplayer variable is tested and, if true, the second of the two input routines is called and control skips to 240. The lines that are skipped control the computer's plane. A direction is choseri at random. The variable rl controls how long the plane flies in that direc- In 460 an initial random value between 1 and 5 is given to rl. Line 470 tests whether the computer's plane is behind the player's. If it is, a random direction for y is generated and the difficulty value is added to rl. Control then passes to 490 and 500 where the x direction is set to home in on the player's plane and the flag to shoot at the player is set to true. Lines 220 and 230 use the directions set up for the computer's action. Short routines at 360 to 430 alter the coordinates. 220 changes the coordinates for left and right, while 230 changes them for up and down. With the new coordinates set up, the main loop continues by calling the first input routine at 530. The routine at 530 tests each key in turn. The variables up, down, left, right and fire contain key numbers for the directions of the joystick. If a switch is closed the relevant variable is altered and then control returns to the main loop. Line 250 compares the old coordinates of the player's (or player one's) plane with its new coordinates. If they are different the plane must have moved. Line 260 does the same for the second plane. Line 270 then updates the old coordinates ready for next time around the loop. The sound command at 800 is slightly special as it uses a negative value for time. This makes the machine gun rattle out 10 rounds. At 830, if the computer's plane has been hit, a noise is made and the number of hits is incremented. If there have been six hits the routine skips to 930, otherwise it returns to the main loop. 930 is the explosion routine for the Baron's plane. The score is incremented. 960 sets the endgame flag and jumps to 1130 to update the score and return to the main loop. This is very similar to the player's shooting routine but sets the computer's action if a hit is made. If the plane is destroyed the explosion routine at 980 is entered. For a two player game shoot3 is set when the second player's gun must be fired. When a plane is shot down the endgame flag is set and line 310 jumps to the end of game routine. The routine at 1050 checks if either of the scores are 10 and prints a message if they are. If the game hasn't ended in line 310 the program loops back to 190 where everything happens again. ACU #8703 |
|
|
Page créée en 230 millisecondes et consultée 1262 fois L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko. |