Frogger (Hopalong) - Richard Archdeacon (Your Spectrum-Issue 3-Page 110) Here's a new version of an old arcade classic - namely Frogger. Written for the 48K Spectrum, the program contains three levels, and instructions are provided within the annotations for you to construct a fourth should you feel adventurous. In much the same way as the arcade original, your task is to get the frog character from the bottom of the screen, negotiating the various hazards and then leaping into one of the four available spaces at the top of the screen. However, you'll soon find that things are not quite that easy. Your problems begin when you try and cross the road - there's a fair amount of traffic to hop around. Needless to say, one hop in the wrong direction and it's frog's legs on the menu tonight! Once across the road, you must get across the river via the floating logs and turtles. And if you think all that sounds well within your grasp, you may be interested to know that all four of your frogs must be hopped home against the clock. The program follows the original fairly faithfully, so there's a good chance most of you will know the rudiments of the game. Movement of your frog character is achieved with the cursor control keys. And at the end of the game, a table is displayed giving the top five scores of the day. The speed of the game is fast for Basic, and compares well with many commercial packages. The program is generally well- structured, although the more experienced programmers amongst you may want to have a closer look at the user-defined graphics sub- routine. Lines 10-20 These two lines initialise the program. (s=score, li=lives remaining and h() is the high score array.) Lines 30-50 New level initialisation. (fr=the frog's home, t=the time left, and a and b are the frog's co-ordinates.) Lines 60-67 Start of the main loop. This reduces the time (t) by one and prints the current value on the screen. Line 67 checks to see if you have run out of time. Lines 70-120 The 'main movement' routine. Lines 70 and 80 rearrange the strings so they look like they are moving from left to right or right to left. Lines 90 and 100 print the objects in their new positions. Lines 110-115 check to see if the frog is on a turtle or log, and move the frog left or right as required. Also, these lines check to see if the frog has hit the edge of the screen. Lines 130-180 The 'main key scan' routine. This routine checks to see if you've pressed one of the cursor keys and if so, jumps to left, right, up or down movement. The PAPER colour is set depending on the frog's position. Lines 200-219 This routine checks to see if the frog has hit a car or lorry, or moved into the water. If so, the action jumps to the 'dead frog' routine. Lines 300-330 This routine checks to see if the frog is still on the screen and increments or decrements b if moved left or right, respectively. The PAPER colour is set depending on the frog's position. Line 320 prints the frog in its new position. Lines 1000-1090 The 'frog moved up' routine. This routine moves the frog up the screen. Line 1015 checks to see if the frog is home. Line 1017 calls the 'hit object yes/no' routine. Line 1050 prints the frog in the new position. Line 1060 increments and prints score. Lines 1500-1590 The 'frog moved down' routine. As for 'move-up' routine, but there is no check for 'home'. Lines 2000-2020 The 'check if home' routine. Line 2000 checks to see if the frog is in a possible home position and if not, the action jumps to the 'dead frog' routine. Line 2001 checks to see if all the home positions are full and if not, the score is incremented and printed. Line 2010 checks to see if all the frogs are home. Lines 2200-2220 The 'all frogs home' routine. Line 2200 prints the time bonus, and line 2210 plays the tune and increments the score. Lines 3000-3040 The 'dead frog' routine. This routine is called after a crash or the allowed time has elapsed. Line 3010 prints a flashing frog, and line 3020 prints the lives left after one has been taken. Line 3030 checks to see if all the lives have gone and if so, the computer plays a tune. Lines 4000-4100 The 'game is over' routine. Line 4020 plays a tune and resets the level back to level one. Lines 4030 and 4040 sort out the high score table. Lines 4050-4080 print the title and high score table, complete with flashing latest score. Line 4090 BEEPs while waiting for a key to be pressed. Lines 7000-7070 Draw the initial screen. Lines 7500-7890 This routine sets up the number of cars, lorries, logs and turtles which appear in each lane on the screen. The variable 'lev' in line 7520 causes a jump to the required data for a particular level. Should you wish to add another level to the game, you must first change the '3' in line 7510 to a '4'. You must then add the following lines: 7900 REM LEVEL 4 7910 LET a$=" logs " 7920 LET b$=" turtles " 7930 LET e$=" lorries " 7940 LET g$=" cars " 7950 LET h$=" racing cars " 7960 RETURN obviously, you can put as many graphic characters as you want in the above strings - but you must make sure that the strings contain 32 characters. Lines 8000-8500 The 'user-definable graphics' routine. Being a Your Spectrum aficionado, you'll probably realise that this routine is not as good as it could be. Take a look at previous issues and see if you can improve upon it. Lines 9000-9080 The 'initial start' routine. The level variable (lev) is set to equal one. Line 9030 prints the title on the screen in large letters and plays a tune before printing a flashing line across the screen. Lines 9040 and 9050 print the scoring and control key details. Line 9060 plays a random note while waiting for a key to be pressed. Line 9090 The 'cassette saving' routine. ------------------------------------------------------------------------------ TYPE: Arcade (Frogger) COMMENT: This info file was typed by Jim Grimwood Downloaded from: Desert Island Disks -- http://www.image.dk/~frankie/ Maintained by: Michael Bruhn -- frankie@image.dk