A downloadable game

Pit Dash

by keyscompany

Platform: BBC Micro Model B or later models

Language: BBC Basic

Category: EXTREM-256


SYNOPSIS

--------

For reasons still classified Captain Dash is trapped sixteen levels down in a dark pit on a distant moon in the Proxima Centauri system with no weapon and only a hostile shapeshifting alien head-scrambler for company. A small point of light is visible far above. Ledges lead up and out but become increasingly narrow nearer the surface. You must guide Captain Dash to the top and outwit the alien. If you make it to the exit you will be rewarded with a score calculated from your speed multiplied by Dash's remaining health.

Fail and the alien will fill Dash's mind with some really really bad ideas.

Good luck.

Controls:-  "A" left - "S" right - "K" jump

HINT: the alien can only inflict damage to Dash's head


FEATURES

- ASCII animated player and enemy

- 16 procedurally generated levels of increasing difficulty

- Sound FX

- Music

- High score


CODE

----

0MODE4:VDU23,1,0;0;0;0;:PRINTTAB(19,8)"."'SPC13"P I T - D A S H"'SPC19"/"'''"by keysco."''''"High Score: ";U%''''"A-Left S-Right K-Jump - Space to Play":DIMP(40,39):C$="\-)\(//-":ENVELOPE1,1,3,0,0,20,0,0,99,-1,0,-4,80,0:Z%=-2:L=0
1D%=1:J%=0:X%=1:Y%=27:A%=X%:B%=Y%:E%=36:F%=2:G%=E%:H%=F%:V=20:S=0:FORN=4TO5:ENVELOPEN,10,-4*N,4*N,12,2,1,1,99,0,0,0,20,0:NEXT:S$="<4<@T@<454544454":REPEATUNTILINKEY-99=-1:K=GET:CLS:FORT=0TO39:P(T,30)=1:P(0,T)=1:P(40,T)=1:NEXT:T%=0:U=TIME
2IFL>15:S%=TIME-U:CLS:PRINTTAB(18,14)"FREE":GOTO3:ELSEM=L DIV4:P=16:FORR=6TO26STEP4:REPEATQ=P+8*(RND(3)-2):UNTILQ<33ANDQ>-1ANDQ<>P:FORN=1TO6-M:PRINTTAB(Q+N,R)"_/":P(Q+N,R)=1:NEXT:P(Q+7-M,R)=1:P=Q:NEXT:PRINTTAB(31,0)"Level ";L+1:GOSUB8
3IFL>15:FORN=0TO20:SOUND2,1,N*9,2:NEXT:W%=(300-S%DIV100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%<>5:IFY%=B%:RETURN:ELSEIFP(X%,Y%)=1ORP(X%,Y%+1)=1ORP(X%,Y%+2)=1X%=A%:RETURN:ELSEIFJ%=0:IFP(X%,Y%+3)=0J%=4:ELSEIFJ%>0Z%=Z%*-1
9FORN=0TO2:VDU31,A%,B%+N:PRINT" ";:NEXT:VDU31,X%,Y%:PRINT".":VDU31,X%,Y%+1:PRINTMID$(C$,5+D%+Z%,1):VDU31,X%,Y%+2:PRINTMID$(C$,4+D%+Z%,1):A%=X%:B%=Y%:Z%=Z%*-1:IF P(X%,Y%+3)=1:SOUND0,-6,2,1:RETURN:ELSE:RETURN


OVERVIEW

--------

SETUP

line 0 - set the mode, print the title page, dimension the array used for the game area, define the string used for player character C$, envelope one used for jump, death and victory sounds

line 1 - set the rest of the game variables, define two more envelopes and string S$ used for background music, wait for key press, setup play area boundaries and start the timer

GAME LOOP

line 2 - IF game completed begin end sequence and GOTO to line 3, ELSE the rest of this line generates the current level

line 3 - IF game completed play a sound (which cuts the music), generate score and GOTO to line 7, ELSE test for player key presses, test if the player is standing on anything or jumping/falling, GOSUB 8 for running movement or GOSUB 7 for jumping/falling movement

line 4 - check health, game over sequence if health is less than 0 - ELSE print the alien IF level 3 or above

line 5 - play background music, calculate coordinates for alien to attack player, play damage sound and lower health if alien in contact with player

line 6 - check Y coordinate to see if level is complete and if so clear level and GOTO line 2 - check if player is jumping/falling and on a platform, increment Y if not, either return to line 3 or calculate X position of player and GOSUB 8 then back to line 3

line 7 - IF game completed print score and check if it is a high score (in which case U%=score) wait for key press then re-RUN the program (U% is retained)- ELSE check on players jump status and whether they've hit a platform

line 8 - check if player is jumping and if they are in contact with platform

line 9 - overprint previous position of player and print new position - if jumping then animation is less frequent - play movement sound if running then RETURN from this subroutine


VARIABLES

---------

LEVELS AND PLAYING AREA

P(40,39) - array used for playing area and platforms (which is actually a bit smaller at 39 by 28 characters)

L  - level number

M, N, P, Q, and R are used in line 2 to generate levels

PLAYER

The position of the player's head is tracked by the variables X% and Y% and the platforms are stored in the P array such that the contents of P(X%,Y%+3) tells you if the player is on a platform or not, since the player is three ascii characters tall.

C$ - ascii characters for player's body "\-)\(//-"

D% - direction the player is facing

Z% - switch for the two states of player animation

J% - controls jumping and falling, set at 0 by default but counts down from 9 when player jumps unless interrupted by a platform, set to 4 if player falls

X% - player head x coordinate

Y% - player head y coordinate

A% - stores players previous x position for overprinting

B% - stores players previous y position for overprinting

C% - used to store key press or no press for "Z" or "X"

K% - used to store key press or no press for "K"

V  - player health

ALIEN

E% - alien x position

F% - alien y position

G% - stores aliens previous x position for overprinting

H% - stores aliens previous y position for overprinting

Z$ - string used to print alien which is an alternating random ascii character: #,&,% or $

In line 5 variables I and J are used in a function to make the alien home in on the player if there isn't a platform in the way

MUSIC (Folia)

Pit Dash takes advantage of the BBC Micro SOUND and ENVELOPE statements to create four different arpeggio patterns which play in the background. The pitches that sound as a result of the ENVELOPE acting on the SOUND statement always stay in time but the rate of change from one arpeggio to the next fluctuates with gameplay as the program has to do more when keys are pressed and the SOUND statement is updated less frequently. The result still sounds reasonable musical however.

S$ - contains the string: "<4<@T@<454544454", the ascii codes of the first eight symbols correspond to pitch parameters for the starting note of each arpeggio in the tune, the final eight characters are turned back into values to set the envelope to either 4 or 5 for two different arpeggio types

S  - used to cycle the music pitch and envelope parameters in line 5 using MOD8

T% - sets the frequency of the changes of pitch and envelope value using MOD38 - this slows down when the player is moving which we'll pretend isn't a limitation of the code but is instead adaptive game music

FINAL SCORE

U  - time of the internal clock at the start of each game

S% - time player takes to finish the game

W% - score calculated from remaining time multiplied by remaining health (the time limit is 5 minutes but nothing happens if you run out of time except a negative score should you happen to finish all the levels)

U% - high score


Download

Download
How_to_RUN 722 bytes
Download
Pit_Dash_Instructions_and_Documentation 8.4 kB
Download
pitdash.ssd 23 kB
Download
PitDash_CODE 2.1 kB

Install instructions

HOW TO RUN PIT DASH

-------------------

RECOMMENDED EMULATOR: b2 - https://github.com/tom-seddon/b2

(WARNING: turn volume down when you first open b2 emulator - square wave beep is way too loud!)

How to start the game in b2:

1. Go to File - Disc Image ...

2. Select and open pitdash.ssd

3. CHAIN"P-INSTR" - for Instructions followed by Game

       OR

   LOAD"PITDASH" - for Game file only - LIST or RUN

RECOMMENDED ONLINE EMULATOR: jsbeeb - https://bbc.xania.org/

How to start the game in jsbeeb:

1. Go to Discs - From examples or local

2. Browse - select pitdash.ssd from local hard drive

3. CHAIN"P-INSTR" - for Instructions followed by Game

       OR

   LOAD"PITDASH" - for Game file only - LIST or RUN

Comments

Log in with itch.io to leave a comment.

Made it to level 14! Very challenging, love the background music!