Well your routine works on QBJS, but mine doesn't; so +1 for that achievement! Mine throws an Error 8, and that's after I convert the GOSUB and get rid of the WIDTH statement.
QBJS Attempt...
[qbjs] _Title "Pete's Mini Space Invaders For QBJS"
bit = 1: TopRow = 5: a$ = "A A A A A A A A": For i = 0 To 4: a$(i) = a$: Next
trail = _Width \ 2 - Len(a$) \ 2: lag = .35: xbase = _Width \ 2: RowHeight = 5: terminate = _Height - 1
Do
Cls: Locate _Height, xbase: Print Chr$(234);: Sound 500, .1
For i = 0 To RowHeight - 1
Locate TopRow + i, trail + l: Print RTrim$(Mid$(a$(i), l + 1));
Next
If TopRow - 1 + RowHeight = terminate Then Locate 3, 2: Print "GAME OVER - YOU LOST!": _Delay 5: End
z1 = Timer
Do
If yfire Then
If Abs(z2 - Timer) > .1 Then
z2 = Timer
If Screen(yfire, xfire) = 24 Then Locate yfire, xfire: Print " ";
yfire = yfire - 1: If yfire < TopRow Then
yfire = 0
Else
Locate yfire, xfire
If Screen(yfire, xfire) = 65 Then
RowCheck = 0: l = 0: r = 0
Mid$(a$(yfire - TopRow), xfire - trail + 1, 1) = " ": Sound 1000, .5: yfire = 0
If LTrim$(a$(0) + a$(1) + a$(2) + a$(3) + a$(4)) = "" Then Cls: Locate 3, 2: Print "GAME OVER - YOU WON!": _Delay 5: End
For i = 4 To 0 Step -1
If LTrim$(a$(i)) = "" And RowCheck = 0 Then RowHeight = i + 1 Else RowCheck = 1
If Len(RTrim$(a$(i))) > r Then r = Len(RTrim$(a$(i)))
If Len(LTrim$(a$(i))) > l Then l = Len(LTrim$(a$(i)))
Next
r = Len(a$) - r: l = Len(a$) - l
Else
Print Chr$(24);
End If
End If
End If
End If
Select Case _KeyHit
Case 19200
If xbase > 1 And restrict = 0 Then Locate _Height, xbase: Print " ";: xbase = xbase - 1: restrict = 1: Locate _Height, xbase: Print Chr$(234);
Case 19712
If xbase < _Width And restrict = 0 Then Locate _Height, xbase: Print " ";: xbase = xbase + 1: restrict = 1: Locate _Height, xbase: Print Chr$(234);
Case -19200, -19712
restrict = 0: _KeyClear
Case 32
If yfire = 0 Then Locate _Height - 1, xbase: Print Chr$(24);: yfire = _Height - 1: xfire = xbase
End Select
If Abs(z1 - Timer) > lag Then z1 = Timer: Exit Do
Loop
If trail + Len(a$) - r > _Width And bit = 1 Or trail = 1 - l And bit = -1 Then bit = -bit: TopRow = TopRow + 1: lag = lag - .025 Else trail = trail + bit
Loop [/qbjs]
I made mine "adaptive" so it can handle the default screen, but the 40 x 20 screen is so much better. Maybe it's obvious to you what is throwing that ERROR 8. If not, I might have some time tonight or tomorrow to step through the code. Also, but I can't remember off the top of my head, I think _NEWIMAGE can mimic SCREEN 0, so I suppose I could set the screen size that way, but I'm not sure if my _WIDTH and _HEIGHT statements would still work. I might fiddle with that later, too.
Pete
Edit: Apologies, the QBJS code box icon didn't place the code in a window using my FireFox browser.
QBJS Attempt...
[qbjs] _Title "Pete's Mini Space Invaders For QBJS"
bit = 1: TopRow = 5: a$ = "A A A A A A A A": For i = 0 To 4: a$(i) = a$: Next
trail = _Width \ 2 - Len(a$) \ 2: lag = .35: xbase = _Width \ 2: RowHeight = 5: terminate = _Height - 1
Do
Cls: Locate _Height, xbase: Print Chr$(234);: Sound 500, .1
For i = 0 To RowHeight - 1
Locate TopRow + i, trail + l: Print RTrim$(Mid$(a$(i), l + 1));
Next
If TopRow - 1 + RowHeight = terminate Then Locate 3, 2: Print "GAME OVER - YOU LOST!": _Delay 5: End
z1 = Timer
Do
If yfire Then
If Abs(z2 - Timer) > .1 Then
z2 = Timer
If Screen(yfire, xfire) = 24 Then Locate yfire, xfire: Print " ";
yfire = yfire - 1: If yfire < TopRow Then
yfire = 0
Else
Locate yfire, xfire
If Screen(yfire, xfire) = 65 Then
RowCheck = 0: l = 0: r = 0
Mid$(a$(yfire - TopRow), xfire - trail + 1, 1) = " ": Sound 1000, .5: yfire = 0
If LTrim$(a$(0) + a$(1) + a$(2) + a$(3) + a$(4)) = "" Then Cls: Locate 3, 2: Print "GAME OVER - YOU WON!": _Delay 5: End
For i = 4 To 0 Step -1
If LTrim$(a$(i)) = "" And RowCheck = 0 Then RowHeight = i + 1 Else RowCheck = 1
If Len(RTrim$(a$(i))) > r Then r = Len(RTrim$(a$(i)))
If Len(LTrim$(a$(i))) > l Then l = Len(LTrim$(a$(i)))
Next
r = Len(a$) - r: l = Len(a$) - l
Else
Print Chr$(24);
End If
End If
End If
End If
Select Case _KeyHit
Case 19200
If xbase > 1 And restrict = 0 Then Locate _Height, xbase: Print " ";: xbase = xbase - 1: restrict = 1: Locate _Height, xbase: Print Chr$(234);
Case 19712
If xbase < _Width And restrict = 0 Then Locate _Height, xbase: Print " ";: xbase = xbase + 1: restrict = 1: Locate _Height, xbase: Print Chr$(234);
Case -19200, -19712
restrict = 0: _KeyClear
Case 32
If yfire = 0 Then Locate _Height - 1, xbase: Print Chr$(24);: yfire = _Height - 1: xfire = xbase
End Select
If Abs(z1 - Timer) > lag Then z1 = Timer: Exit Do
Loop
If trail + Len(a$) - r > _Width And bit = 1 Or trail = 1 - l And bit = -1 Then bit = -bit: TopRow = TopRow + 1: lag = lag - .025 Else trail = trail + bit
Loop [/qbjs]
I made mine "adaptive" so it can handle the default screen, but the 40 x 20 screen is so much better. Maybe it's obvious to you what is throwing that ERROR 8. If not, I might have some time tonight or tomorrow to step through the code. Also, but I can't remember off the top of my head, I think _NEWIMAGE can mimic SCREEN 0, so I suppose I could set the screen size that way, but I'm not sure if my _WIDTH and _HEIGHT statements would still work. I might fiddle with that later, too.
Pete
Edit: Apologies, the QBJS code box icon didn't place the code in a window using my FireFox browser.

