The Hero
Define character stats as variables and display them on a title screen — the foundation of every RPG.
Every RPG begins with a character. Before there are dungeons to explore or monsters to fight, there must be a hero with stats that define what they can do. Hit points determine how much damage they can survive. Attack determines how hard they hit. Defence determines how well they absorb incoming blows. These three numbers drive every system in Dungeons of Dorin.
The Program
5 REM === DUNGEONS OF DORIN ===
10 BORDER 0: PAPER 0: INK 7: CLS
20 PRINT AT 3, 4; INK 7; BRIGHT 1; "DUNGEONS OF DORIN"
30 PRINT AT 6, 2; INK 6; "Descend ten floors of"
35 PRINT AT 7, 2; INK 6; "darkness. Find the Heart."
40 PRINT AT 10, 2; INK 7; "Press any key to begin"
50 PAUSE 0
60 CLS
70 REM === define stats ===
80 LET h = 20: LET z = 20: LET a = 3: LET f = 2
90 PRINT AT 3, 6; INK 7; BRIGHT 1; "YOUR HERO"
100 PRINT AT 6, 4; INK 7; "HP: "; h; "/"; z
110 PRINT AT 8, 4; INK 4; "Attack: "; a
120 PRINT AT 10, 4; INK 5; "Defence: "; f
130 PRINT AT 14, 4; INK 6; "Your quest begins..."
140 STOP
How It Works
Line 10 sets up the screen with a black border and black paper, then clears the display. The dark colour scheme sets the mood for a dungeon game.
Lines 24-28 define the character stats as variables. h is current HP (20), z is maximum HP (20), a is attack (3), and f is defence (2). Additional variables track gold (g), floor number (e), kill count (q), and turn count (b). Using single-letter variables keeps the code compact — a practical choice when every character counts in BASIC.
Lines 2500-2598 are the title screen subroutine. It prints the game name in bright white, a short description of the quest, the controls, and a legend showing what each symbol means. PAUSE 0 waits for a keypress before returning.
Line 15 calls the title screen with GO SUB, then the program ends. In later units this will flow into dungeon generation and the main game loop.
Stats as Variables
RPG stats are just numbers stored in variables. There is nothing magical about them — they are the same LET assignments used in every previous game. What makes them powerful is how they interact. Attack and defence feed into the combat formula. HP determines survival. Gold tracks progress. Floor number controls difficulty. Each variable has a purpose, and together they define the state of the game.
The choice of starting values matters. HP 20 gives the player room to take several hits before dying. Attack 3 and defence 2 mean combat is weighted slightly in the player favour on early floors, but tougher monsters will challenge those numbers. These values were chosen through playtesting — adjusting them changes the feel of the entire game.
Try This
Change the starting stats. Set attack to 10 and defence to 10. How would that change the balance of combat? What about HP 5 with high attack — a glass cannon build?
Add a new stat. What would a “luck” stat do? Where in the game would it apply? Think about how it would interact with existing systems before writing any code.