skip_intro:
DIM SHARED lmargin%
, rmargin%
, topmargin%
, screenwidth%
, level
, ibk
, ileadingrow
DIM SHARED irow
, icol
, inextrnd
, imaxalienmissiles
, alienforce%
, ileadingmax
, imaxalienforce
, ihits
, score$
score$ = "000000"
imaxalienforce = 6
imaxalienmissiles = 3
lmargin% = 2
rmargin% = 79
topmargin% = 3
ialiencolstat = 6
iwin = 3 ' 3 Levels.
screenwidth% = rmargin% - lmargin% + 1
ibk = 0 ' Background color
'fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\lucon.ttf" 'Find Windows Folder Path.
'font& = _LOADFONT(fontpath$, 25, "monospace")
'_FONT font&
score$
= "069000":
CALL displayhighscores:
RUN
REDIM highscore$
(6), hsdata$
(6) ''' IF _FILEEXISTS("ascii-invaders-high-score.dat") THEN
''' OPEN "ascii-invaders-high-score.dat" FOR RANDOM AS #1 LEN = 25
''' FOR i = 1 TO 5
''' GET #1, i, hs
''' highscore$(i) = MID$(hs, 10, 6): hsdata$(i) = hs
''' NEXT
''' CLOSE #1
''' ELSE
''' END IF
msg$ = " HIGH SCORE / Enter Your Initials! "
msg$ = " Top 5 Score. Enter Your Initials! "
a = 14
t$ = msg$
PSLC
4.6, 41 - LEN(msg$
) \
2, t$
font
= _LOADFONT("lucon.ttf", 20, "monospace")
delay = .4
lscr = 19
initials$ = "": i = 0: nxt = 0
COLOR , _RGB(24, 24, 24): t$
= " " ' Blank initials for redo. Okay to blank at start. PSL 5 + rank * 2, lscr, t$
underline 5 + rank * 2, lscr + nxt, 0
underline 5 + rank * 2, lscr + nxt, -1: uflag = 0
initials$
= initials$
+ CHR$(64 + i
) nxt = nxt + 1 ' Next initial
i = 0 ' Reset alphabet.
kflag = -2 ' All 3 initials have been input.
underline 5 + rank * 2, lscr + nxt, -1: uflag = 0
kflag = -1 ' Alt key pressed.
i
= i
+ 1:
IF i
> 26 THEN i
= 1 PSL 5 + rank * 2, lscr + nxt, t$
PSL 5 + rank * 2, lscr + nxt, t$
underline 5 + rank * 2, lscr + nxt, 0
IF ABS(z2
- TIMER) > 2 THEN ' Key down long enough to indicate redo input. IF nxt
> 0 THEN ' Redo last initial input. underline 5 + rank * 2, lscr + nxt, -1: uflag = 0
nxt = 0: i = 0
initials$ = ""
PSL 5 + rank * 2, lscr, t$
z1
= TIMER ' Reset enter timer. i = 0
PSL 5 + rank * 2, lscr, t$
z1
= TIMER ' Reset enter timer.
kflag = 0 ' Alt key up
CASE -2 ' Finished. Initials will flash until confirmed by 2-second timer. j = 0
COLOR DarkOrange: t$
= initials$
PSL 5 + rank * 2, lscr, t$
PSL 5 + rank * 2, lscr, t$
kflag = -3
kflag = -4
l$ = "8"
n$
= "n24":
PLAY "L" + l$
+ n$
n$
= "n28":
PLAY "L" + l$
+ n$
n$
= "n28":
PLAY "L" + l$
+ n$
l$ = "7"
n$
= "n31":
PLAY "L" + l$
+ n$
l$ = "9"
n$
= "n28":
PLAY "L" + l$
+ n$
l$ = "3"
n$
= "n31":
PLAY "L" + l$
+ n$
kflag = 1
kflag = 0 ' Repeat enter initials
nxt = 0
i = 0
hsname$ = initials$
'''OPEN "ascii-invaders-high-score.dat" FOR RANDOM AS #1 LEN = 25
'''FOR i = 1 TO 5
''' hs = hsdata$(i)
'''IF LEFT$(hs, 1) = "" THEN MID$(hs, 1, 2) = "0" + LTRIM$(STR$(i))
'''PUT #1, i, hs
'''NEXT
'''CLOSE #1
_FONT 16 'select inbuilt 8x16 default font
_DEST 0 'Reset dest back to the normal screen 0.
EXIT DO ' Not in the top 5 highest scores so exit sub.
hardware_overlay:
font
= _LOADFONT("lucon.ttf", 20, "monospace")
bxy% = 3
bxx% = 13
PSL bxy%, bxx% - 1, t$
PSL bxy% + i, bxx% - 1, t$
PSL bxy% + i, bxx% - 1, t$
bxy% = 4
t$ = " NAME SCORE DATE "
PSL bxy% + 1, bxx% + 1, t$
t$ = hsdata$(i)
PSL bxy% + 1 + i * 2, bxx% + 2, t$
hiscore:
MID$(hsdata$
(6), 10, 6) = score$
highscore$(6) = score$
SWAP highscore$
(i
), highscore$
(j
) SWAP hsdata$
(i
), hsdata$
(j
)
SUB underline
(y
, x
, uflag
) ucnt = -ucnt - 1