Sometimes to better manage the time to code and run a new routine in an existing project, I'll, instead, just make a separate stand alone routine to test out the effects.
If line 2 works for your system to make the screen larger, you can unremark it. That's right, just like most of my routines, it's unremarkable.
So here's just the saucer part without player interaction. I think it's a nice effect for under 100 lines of code.
If line 2 works for your system to make the screen larger, you can unremark it. That's right, just like most of my routines, it's unremarkable.
So here's just the saucer part without player interaction. I think it's a nice effect for under 100 lines of code.
Code: (Select All)
Width 60, 20
Rem myfont& = _LoadFont(Environ$("SYSTEMROOT") + "\fonts\lucon.ttf", 21, "MONOSPACE"):_Font myfont&
Dim Obj As String: Obj = "-é-"
lm = 1: rm = _Width: spd = .05
ReDim sbomby(10), sbombx(10)
Locate 7, 20: Print "A A A A A A A A A A A A"
Locate 8, 20: Print "A A A A A A A A A A A A"
Locate 9, 20: Print "A A A A A A A A A A A A"
Locate _Height, _Width \ 2: Print Chr$(234);
Do
If Abs(z4 - Timer) > .015 Then
z4 = Timer: If SaucerAttack = 0 Then i = Int(Rnd * 20): If i = 7 Then SaucerAttack = 1
End If
If SaucerAttack Then
If Abs(z - Timer) > spd Then
saucer Obj, z, lm, rm, xsaucer, sbomb, sbomboff, sbomby(), sbombx(), OffScrn
End If
If OffScrn = 1 Then SaucerAttack = 0: xsaucer = -1: OffScrn = -1
End If
If sbomb Then SaucerBombs sbomb, sbomboff, sbomby(), sbombx()
Loop
Sub saucer (obj As String, z, lm, rm, xsaucer, sbomb, sbomboff, sbomby(), sbombx(), OffScrn)
Static way, oldway, nodc
If sbomboff = 0 And xsaucer = 0 Then ReDim sbomby(10), sbombx(10)
If xsaucer < 0 Then way = 1: xsaucer = 0: nodc = 0
If way < 0 Then rebound = 1 Else rebound = 0
MarqueeLIB obj, lm, rm, way, 3, xsaucer, wrapper, rebound, 1, OffScrn: z = Timer
Sound 1000, .1, .3, 1: Sound 300, .2, .1, 1, 7
If nodc < 4 And xsaucer > lm + 5 And xsaucer <= rm - Len(obj) Then
i = Int(Rnd * 30): If i = 1 Then way = -way
End If
If way <> oldway Then oldway = way: nodc = nodc + 1
If Int(Rnd * 10) = 1 And sbomb < 10 Then
If xsaucer - way * 2 >= lm And xsaucer - way * 2 <= rm Then
sbomb = sbomb + 1: sbomboff = sbomboff + 1
sbomby(sbomb) = 4: sbombx(sbomb) = xsaucer - way * 2
Locate sbomby(sbomb), sbombx(sbomb)
End If
End If
End Sub
Sub SaucerBombs (sbomb, sbomboff, sbomby(), sbombx())
Static z5
If Abs(z5 - Timer) > .075 Then
For i = 1 To sbomb
If sbomby(i) Then
If Screen(sbomby(i), sbombx(i)) = 249 Then Locate sbomby(i), sbombx(i): Print " ";
If sbomby(i) < _Height Then
sbomby(i) = sbomby(i) + 1
If Screen(sbomby(i), sbombx(i)) = 32 Then Locate sbomby(i), sbombx(i): Print Chr$(249);
Else
If Screen(sbomby(i), sbombx(i)) = 234 Then End
sbomboff = sbomboff - 1: sbomby(i) = 0: If sbomboff = 0 Then sbomb = 0
End If
End If
Next
z5 = Timer
End If
End Sub
Sub MarqueeLIB (Object As String, LtMargin, RtMargin, way, y, x, wrapper, rebound, AllowOffScrn, OffScrn)
Static j, k, oldway
If wrapper Then AllowOffScrn = 0: rebound = 0
Dim a As String
If j = 0 Or OffScrn = -1 Then
j = Len(Object): oldway = 0: oldwrapper = wrapper
If way = 0 Then way = 1
If way > 0 Then x = LtMargin Else x = RtMargin
End If
If oldway And way <> oldway Then
If way < 0 Then If x = 1 Or x = 2 Then x = k - (2 - x) Else x = x - j - 1
If way > 0 Then If x = k Or x = k - 1 Then x = 2 - (k - x) Else x = x + j + 1
End If
oldway = way: OffScrn = 0
k = RtMargin + 1 - LtMargin
a = Space$(RtMargin + 1 - LtMargin)
If way > 0 Then
i = x - j + 1: If i < 1 Then i = 1
Mid$(a, i) = Mid$(Object, j + 1 - x)
If wrapper Then If x > k Then Mid$(a, 1) = Mid$(Object, j - (x - 1 - k)) Else Mid$(a, k - Len(Object) + x + 1) = Mid$(Object, 1, Len(Object) - x)
End If
If way < 0 Then
Mid$(a, x) = Mid$(Object, 1)
If wrapper Then If x < 0 Then Mid$(a, k + x) = Mid$(Object, 1, -x + 1) Else Mid$(a, 1) = Mid$(Object, k + 2 - x)
End If
Locate y, LtMargin: Print a;
If way > 0 Then
x = x + 1: If x > k + j Then If wrapper Then x = j Else x = LtMargin
Else
x = x - 1: If j + x = 1 Then If wrapper Then x = k + 1 - j Else x = k
End If
If rebound Then If x = 0 Or x > k Then way = -way
If AllowOffScrn Then If way > 0 And x = 1 Or way < 0 And x = k Then OffScrn = 1: Locate y, LtMargin: Print Space$(k);
End Sub

