Can you calculate the angle and velocity to sink the enemy? David Muir's game will have you trying In this game you control the armoury of one of the two facing gunboats. You have the option to move your boat, fire shells and alter the velocity of the shell. Your enemy is controlled by the computer and fires, moves and changes its velocity at random. The program uses the following formulae to calculate the parabolic motion of the projectiles: - x (horizontal displacement) = start velocity * time * cos (angle of fire)
- y (vertical displacement) = start velocity * time * sin (angle of fire) - time * time * gravity/2
The angle of fire is set, by the program, to 30 degrees. Rather than have lime appearing in the formulae they have been compounded into one complex formula.When a shell is fired it moves horizontally one column at a time, the vertical position of a shell is calculated, the old position is erased and the shell printed in the new position. The program contains title page, instructions and a large number of REM statements so that you can follow its working. Control can be via either cursor keys or joystick. Home Computing Weekly #115 |