--- title: "Dead Ducks" id: 50610 type: "computer_media" slug: "dead-ducks" url: "http://localhost/computer_media/dead-ducks/" markdown_url: "http://localhost/computer_media/dead-ducks.md" published_at: "2023-06-23T11:26:00+00:00" modified_at: "2026-03-30T21:41:39+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2019/02/20230809-041332.jpg" excerpt: "Aim your cannon at moons and ducks across five rounds — this two-player artillery game uses custom UDG sprites and parabolic trajectory math to decide your fate." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Game" slug: "game" taxonomy: "genre" url: "http://localhost/type/game/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/Dead%20Ducks%20%28198x%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2023/06/SCR-20260329-pulv.png" media_type_tags: "Game" --- # Dead Ducks This program is a two-player artillery game in which players take turns firing a cannon at targets — a moon (UDG A–C), ducks (UDG D–J), and a barrel — by entering a launch angle between 45 and 85 degrees. The first 80 lines define ten custom UDG characters (A through J) using POKE USR to create sprite graphics for the moon, barrel/cannon components, and a duck shape. Projectile trajectory is computed using parabolic formulas: horizontal position as `x = INT(0.056 * i * (90 – a))` and vertical height as `y = INT(i * (100 – i) * 0.07)`, with collision detection performed via the ATTR function to test whether the plotted pixel lands on a colored cell. The game tracks hits on moons and total shots across five rounds, displaying running scores in the border area. *** ## Program Analysis ### Program Structure The program divides into three logical phases: 1. **UDG Setup (lines 10–80):** Reads bitmap data for ten custom characters (A–J) from DATA statements and POKEs them into UDG memory using `USR a$` as the base address. 2. **Game Loop (lines 90–320):** Iterates five rounds (`FOR g=1 TO 5`), placing targets at random screen positions, accepting angle input from up to two players, simulating a projectile, and checking for collision. 3. **Subroutine / End (lines 340–510):** Displays a final summary and provides a “Press ENTER to continue” pause routine at line 500. ### UDG Character Definitions Lines 10–80 define UDGs A through J, each encoded as 8 bytes of bitmap data stored in the DATA statements on lines 70–80. The inner loop (`FOR d=0 TO 7`) POKEs each byte to `USR a$+d`, where `a$` holds the character letter as a one-character string. The ten UDGs collectively form the graphical sprites used in the game: | UDG | Role | | --- | --- | | A, B, C | Moon — top, middle, bottom rows | | D, E, F, G, H | Barrel/cannon top assembly (five cells wide) | | I, J | Barrel/cannon base flanks | ### Trajectory Calculation The projectile path is computed inside `FOR i=0 TO 100` at lines 220–242. Two formulas drive position: - `x = INT(0.056 * i * (90 - a))` — horizontal screen column, scaled by the complement of the angle. - `y = INT(i * (100 - i) * 0.07)` — vertical pixel height using a symmetrical parabola centered at `i=50`. Each step plots a pixel with `PLOT x, y` and emits a tone with `BEEP 0.1, f/100` where `f = i*(100-i)`, giving a pitch that rises and falls to match the arc shape. ### Collision Detection via ATTR Line 240 converts pixel coordinates to character-cell coordinates: `lin = 21 - INT(y/8)` and `col = INT(x/8)` (note: `col` is derived from `y` in the listing — this is likely a bug where the variable name `col` is misleadingly computed from the vertical coordinate rather than the horizontal one). The ATTR value of that cell is then tested; if it exceeds 64 (meaning a colored, non-black attribute is present), a hit is registered at line 250. A secondary check at line 280 tests `col>d AND col85 THEN INPUT (a;" is not between 45 and 85."'"Reenter angle: ");a: GO TO 200 210 PRINT AT 1,0;"Angle= ";a 220 FOR i=0 TO 100 230 LET x=INT (0.056*i*(90-a)): LET f=i*(100-i): LET y=INT (f*0.07): PLOT x,y 235 BEEP 0.1,f/100 240 LET lin=21-INT (y/8): LET col=INT (y/8): IF ATTR (lin,col)>64 THEN GO TO 250 242 NEXT i 245 PRINT AT 20,d-4;"Miss": GO TO 295 250 IF lin>3 THEN GO TO 280 260 LET hm=hm+1: PRINT AT 1,25;hm 270 FOR z=1 TO 18: PRINT INK 4;AT z,m;" ";AT z+1,m;"\a";AT z+2,m;"\b";AT z+3,m;"\c": BEEP 0.1,1-z: NEXT z 275 GO TO 310 280 IF col>d AND col