Skip to content
Game 14 Unit 3 of 32 1 hr learning time

The Ship

Display the player ship UDG at the bottom of the screen — it looks like a real game sprite.

9% of Blockstorm

The ship UDG is designed. The bullet UDG is designed. Now they need to appear in the right places. The player ship sits near the bottom of the screen, white against the black background. The bullet appears just above it when fired. This unit places both UDGs on screen and introduces INK control for individual PRINT AT statements.

The Program

5 REM === THE SHIP ===
10 BORDER 0: PAPER 0: INK 7: CLS
20 REM Define UDG I: player ship
30 FOR i = 0 TO 7
40 READ a
50 POKE USR "I" + i, a
60 NEXT i
70 DATA 16, 56, 56, 124, 254, 254, 130, 0
80 REM Define UDG E: bullet
90 FOR i = 0 TO 7
100 READ a
110 POKE USR "E" + i, a
120 NEXT i
130 DATA 16, 56, 16, 16, 0, 0, 0, 0
140 LET px = 15: LET py = 20
150 PRINT AT py, px; INK 7; CHR$ 152
160 PRINT AT 0, 0; INK 7; BRIGHT 1; "BLOCKSTORM"
170 PRINT AT 0, 20; INK 6; "Ship ready"
180 PAUSE 0

How It Works

Lines 10-50 define the ship and bullet UDGs using the DATA and POKE loop from the previous unit. Both characters are defined before anything is drawn.

Line 60 clears the screen. The black PAPER setting from line 10 means the entire screen is now a black void — the backdrop of space.

Line 70 places the ship at row 20, column 15. PRINT AT 20, 15 positions the character near the bottom centre of the screen. INK 7 makes it white. CHR$ 152 is UDG I — the player ship.

Line 80 places a bullet UDG at row 19, directly above the ship. INK 7 again. CHR$ 148 is UDG E — the bullet.

INK in PRINT AT

You have used INK as a standalone command before — INK 7 sets the default ink colour for everything that follows. But you can also set INK within a single PRINT AT statement:

PRINT AT 20, 15; INK 7; CHR$ 152

The INK 7 applies only to this one character. It does not change the default ink colour. This is how Blockstorm colours different elements: the ship in white, enemies in green or cyan, explosions in red — all within individual PRINT AT calls.

Screen Position

Row 20 is near the bottom of the 22-row screen (rows 0 to 21). Row 0 will be reserved for the HUD — score, lives, wave number. The play area runs from row 1 down to row 21, with the ship fixed at row 20. Enemies will descend from the top. The gap between row 0 (HUD) and row 20 (ship) is the battlefield.

Try This

Move the ship to different columns. Change the column number in the PRINT AT call. The ship can sit anywhere from column 0 to column 31. Where feels right as a starting position?

Place an enemy above. Define UDG A (the drone) with the data from the curriculum: DATA 36, 126, 219, 255, 255, 102, 66, 0. Display it in green (INK 4) at row 3, column 15. You now have a target to shoot at.