Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 9, NO. 6 / JUNE 1983 / PAGE 258

Soaring cycles. (high-resolution graphics simulation of a motorcycle jump) Daniel Storch.

Soaring Cycles

With the roar of the crowd in your ears, you nose your motorcycle up to the starting line. You nervously glance down the long runway to the ramp and the ten buses beyond. There is no time to turn back.

Letting out the clutch, you gun the engine. You race down the runway gaining speed and watch as the ramp looms closer. With a jarring impact, your bike hits the ramp and goes flying through the air.

From your bird's eye view, you know it is going to be close. As your bike descends, you check your position . . . it will be close . . .

No need to worry though, because if you crash, you will only have to run the program again. Soaring Cycles is a fast, high-resolution graphics simulation of a motorcycle jump. It is written in Applesoft Basic and uses standard shape tables and sound effects.

When writing this program, I valued clarity over efficiency, so some parts of the program may seem rather slow and cumbersome. However, it can easily be modified to obtain quicker and smoother animation (not only by using more advanced animation techniques, but by generally improving the program execution speed).

The Program

To aid you in understanding the program better and to guide you in modifying it, I have listed the variables used and a step-by-step explanation of how the program works.

Variables B - Number of buses you wish to jump. K - If K = 1 then you have crashed; if not, you made a successful jump. N - The new throttle setting. O - The old throttle setting. S - The sound constant.

S1--The shape rotation variable. X1 - The x coordinate of the motorcycle for drawing. X2 - The x coordinate of the motorcycle for erasing. Y1 - The y coordinate of the motorcycle for drawing. Y2 - The y coordinate of the motorcycle for erasing.

C, I, P, V--Used in FOR/NEXT loops.

Explanation

Lines 10-100 print the title page and instructions.

Lines 110-180 initialize the program.

Lines 190-240 draw the buses, the ground, and the ramps.

Lines 250-260 read the paddle, update the variables, and check for overacceleration (top of the main program loop).

Line 270 determines if you have hit the ramp yet.

Line 280 is the sound routine.

Line 290 changes the x coordinate of the bike.

If the motorcycle goes off the screen to the left, line 300 lowers it a level and sets it back to the far right.

Line 310 erases the motorcycle at the old position, draws it at the new position, and goes to the top of the loop.

The short loop in lines 350-430 shows the bike flying upward off the ramp (The angle of flight depends on spped).

Lines 440-490 make the bike descend (Line 480 determines if the bike has landed and whether or not the jump is successful).

If you are still alive, line 500 sends the program to the victory routine.

Lines 510-560 prepare the screen for the crash.

Lines 570-640 are the crash loop that makes your motorbike go in circles.

Lines 650-670 draw the bike resting upside down on the ground.

Line 680 returns to the beginning of the program so you can try again.

Lines 690-710 prepare the screen and print the victory message.

The victory routine in lines 720-770 shows your motorcycle triumphantly riding a wheelie off the screen.

I was able to use eight different rotations for my shapes even though page 99 of the Applesoft Reference Manual states that when the SCALE=1 only four are available.

Entering the Program

Soaring Cycles contains two parts which must be entered, the Applesoft Basic program and the shape table. After entering the Basic program, simply type SAVE SOARING CYCLES. Now, go into the system monitor (using CALL-151) and program in the shape table. When you are finished, just type BSAVE BIKE, A$5600, L$60.

Now strap on your crash helmet, put on your riding gloves, and run the program.

Table: Listing 1.

Table: Shape Table.

Photo: Middle of a jump.

Photo: A successful jump.