Duck Shoot (Artillery)

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Game

Duck Shoot is an artillery game. Each of five rounds puts a duck at a random spot on the waterline and the moon at a random point in the sky. You get two shots per round. Type a barrel angle between 45 and 85 degrees, and the program plots the shell’s arc across the screen from the bottom-left corner. A direct hit prints DEAD and a glancing one OUCH. Hitting the moon sends it tumbling down the screen with a falling sound effect. Counters show ducks, moons and shots, and the final screen reports “YOU KILLED n DUCKS WITH n SHOTS” and how many times you hit the moon.

The program has no credit. It was on two Larken game menu disks. This post uses the copy from the Games disk; the copy on the Alley disk adds only two lines that exit to the Larken menu.

Program Analysis

Trajectory

The shell’s path is a parabola calculated in a loop from 0 to 200: X=INT (.028284*I*(90-A)) and Y=INT (I*(200-I)*0.0172). Each point is PLOTted, and the position is checked against the moon’s box near the top of the screen and the duck’s box on the waterline. A steeper angle gives a shorter, higher shot.

Sound and graphics

The duck, moon and water are made from block graphics and coloured PRINTs. All the effects use the TS2068 SOUND command to program the AY sound chip directly: a rifle crack when you fire, a falling tone tied to the shell, and a three-note chord with border flashes (lines 2005–2100) for a hit and at the end of the game.

Notable Techniques

  • Direct AY register programming with SOUND for noise, tone and envelope effects.
  • A shell pitch that tracks the loop counter, so the tone falls as the shell drops.
  • The round number appears inverse on the duck.

Potential Issues

  • Entering 0 as the angle runs GO TO 0, and line 0 is SAVE "DCKSHT" LINE 1, so it starts a tape save instead of quitting.
  • GO SUB 2000 relies on falling through to line 2005, because there is no line 2000.
  • The X=D2+8 test in line 410 makes a shell landing on exactly one pixel column inside the duck count as OUCH; it appears to be a slip for a range check.

This copy came from a Larken disk. For tape, the LKDOS PRINT #4 prefixes were removed from the SAVE and LOGICALL lines, the autostart was set to line 1, and the saved variables were dropped. It was tested in ZEsarUX on a stock TS2068.

Image Gallery

Source Code

    0 SAVE "DCKSHT" LINE 1
    2 LET HD=0
    4 LET HM=0
    6 LET S=0
    8 BORDER 0: PAPER 0: BRIGHT 1: INK 7
   10 FOR G=1 TO 5
   20 CLS 
   30 LET D=INT (RND*16)+12
   40 LET M=INT (RND*7)+12
   45 LET M2=M*8
   46 LET D2=D*8
   50 PRINT "BARREL"
   60 PRINT "ANGLE=?"
   70 PRINT AT 0,25;HD;"DUCKS"
   80 PRINT AT 1,25;HM;"MOONS"
   90 PRINT AT 2,25;S;"SHOTS"
  100 PRINT AT 1,M; INK 6;".'"
  110 PRINT AT 2,M;": "
  120 PRINT AT 3,M;"'."
  130 PRINT AT 21,0; PAPER 1; INK 5;"++++++++++++++++++++++++++++++++"
  140 PRINT AT 20,D; INK 6;"-;  /"
  150 PRINT AT 21,D; PAPER 1; INK 6; BRIGHT 0;" :::"; PAPER 0; INVERSE 1;CHR$ (G+48); PAPER 1; INVERSE 0;":'"
  160 FOR B=1 TO 2
  170 PRINT AT 0,6;B
  180 PRINT AT 1,6;"? "
  190 INPUT A
  200 IF A=0 THEN GO TO 0
  201 IF A>85 OR A<45 THEN GO TO 190
  202 REM PATH OF BULLET
  203 PRINT AT 1,6;A
  204 PRINT AT 21,0; PAPER 6;"*";AT 21,0; PAPER 2;"*";AT 21,0; PAPER 1; INK 5;"+"
  207 SOUND 6,15;7,7;8,16;9,16;10,16;12,16;13,0
  208 PAUSE 60
  209 SOUND 0,0;1,0;2,0;3,0;4,0;5,0
  210 FOR I=0 TO 200
  220 LET X=INT (.028284*I*(90-A))
  230 LET Y=INT (I*(200-I)*0.0172)
  240 PLOT X,Y
  245 IF I<110 THEN GO TO 250
  246 SOUND 7,62;8,15
  247 LET J=I-50
  248 SOUND 0,J
  250 IF X<M2 OR X>M2+8 OR Y>167 OR Y<144 THEN GO TO 400
  270 LET HM=HM+1
  280 FOR Z=1 TO 18
  290 PRINT AT Z,M;" "
  300 PRINT AT Z+1,M;".'"
  310 PRINT AT Z+2,M;": "
  320 PRINT AT Z+3,M;"'."
  321 LET J=J+6
  322 SOUND 0,J
  330 NEXT Z
  335 SOUND 6,6;7,7;8,16;9,16;10,16;12,56;13,8
  336 PAUSE 90
  338 SOUND 8,0;9,0;10,0
  340 LET S=S+1
  350 PRINT AT 2,25;S
  360 GO TO 530
  400 IF X<D2 OR X>D2+38 OR Y>12 THEN GO TO 495
  405 GO SUB 2000
  410 IF X<D2+6 OR X=D2+8 OR X>D2+32 THEN GO TO 450
  420 PRINT AT 20,D-4;"DEAD"
  430 LET HD=HD+1
  432 LET S=S+1
  434 PRINT AT 2,25;S
  440 GO TO 530
  450 PRINT AT 20,D-4;"OUCH"
  491 REM COPY 
  492 GO TO 510
  495 NEXT I
  496 SOUND 6,6;7,7;8,16;9,16;10,16;12,56;13,8
  497 PAUSE 90
  498 SOUND 8,0;9,0;10,0
  500 LET S=S+1
  505 PRINT AT 2,25;S
  510 PAUSE 150
  520 NEXT B
  530 PAUSE 150
  540 NEXT G
  550 CLS 
  555 BORDER 1
  560 PRINT AT 7,8; PAPER 7; INK 2; BRIGHT 0;"  T H E  E N D  "
  570 PRINT AT 12,7;"YOU KILLED ";HD;" DUCKS"
  580 PRINT AT 14,10;"WITH ";S;" SHOTS"
  590 PRINT AT 16,4;"YOU HIT THE MOON ";HM;" TIMES"
  600 GO SUB 2000
  610 IF INKEY$="" THEN GO TO 610
  620 GO TO 1
 2005 SOUND 0,0;1,0;2,0;3,0;4,0;5,0
 2010 SOUND 7,56
 2020 SOUND 0,68;1,3;8,15
 2030 PAUSE 60
 2035 BORDER 6
 2040 SOUND 2,151;3,2;9,15
 2050 PAUSE 60
 2055 BORDER 4
 2060 SOUND 4,46;5,2;10,15
 2070 PAUSE 300
 2075 BORDER 0
 2080 SOUND 0,0;1,0;2,0;3,0;4,0;5,0
 2100 RETURN 
 9996 SAVE "DCKSHT.B1" LINE 1
 9998 REM  was LKDOS-only

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.