Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mini Space Invaders
#11
@bplus Hey man, my points aren't here man! You must have had one of my senior moments!

Yeah, I've seen that little ship, before. Nice small code to get the spinning effects. Looks like the one we found in Roswell... you know, the one with "Student Flyer" written in Klingon on the hull.

Well still screwing around with trying to make that marquee lib I'm refining to drive as much of this game as possible. It worked for the saucer. Now here is the part for the marching alien forces. The next involvement will be to get the lib to handle multiple sequences, meaning a few of the variables will need to be mocked up into arrays.

Code: (Select All)
Width 40, 20: _Font 16: _ScreenMove _Middle
Dim object As String
object = "A A A A A A A A A A A A": y = 5: way = 0: repeat = 4
Do
    If Abs(z1 - Timer) > .1 Or way = 0 Then
        z1 = Timer
        If rebound < 0 Then rebound = -rebound: Locate y, 1: Print Space$(_Width);: y = y + 1
        MarqueeLIB object, LtMargin, RtMargin, way, y, st, wrapper, rebound, AllowOffScrn, OffScrn, repeat
        If way = 0 Then way = -1: rebound = 2: _Delay 1.5
        If y + 4 = _Height Then Sleep 10: End
    End If
Loop

Sub MarqueeLIB (Object As String, LtMargin, RtMargin, way, y, x, wrapper, rebound, AllowOffScrn, OffScrn, repeat)
    Static j, st, oldst, flipway
    Dim a As String
    If j = 0 Or OffScrn Then
        If OffScrn = -1 Then
            If st > 1 Then Locate y, RtMargin Else Locate y, LtMargin
            Print " ";: OffScrn = 1: Exit Sub
        End If
        j = Len(Object): oldst = 0: flipway = way: OffScrn = 0
        If LtMargin = 0 Or RtMargin = 0 Then LtMargin = 1: RtMargin = _Width
        If y = 0 Then y = 1
        If x = 0 And st = 0 Then st = LtMargin
        If way > 0 And st = 0 Then st = LtMargin + 1 - j
        If way < 0 And st = 0 Then st = RtMargin
        If way = 0 Then st = RtMargin \ 2 - j \ 2 + 1
    End If
    k = RtMargin + 1 - LtMargin
    If wrapper Then wrapper = j - 1
    If flipway <> way Then
        flipway = way: st = oldst + way
        If way > 0 Then If st > k Then st = LtMargin + 1 - j + wrapper
        If way < 0 Then If st + j = LtMargin Then st = k - wrapper
    End If
    oldst = st: a = Space$(k): Mid$(a, st) = Object
    If wrapper Then
        If way Then If st < 1 Then Mid$(a, k + st, 1 - st) = Mid$(Object, 1, -st + 1)
        If way Then If st - 1 + j > k Then Mid$(a, 1) = Mid$(Object, k + 2 - st)
    End If
    If rebound = 1 And wrapper = 0 Then If way < 0 And st = LtMargin Or way > 0 And st - 1 + j = k Then way = -way: rebound = -rebound
    If rebound = 2 And wrapper = 0 Then If way < 0 And st = LtMargin - 1 Or way > 0 And st - 1 + j > k Then way = -way: rebound = -rebound: st = oldst: Exit Sub
    If AllowOffScrn And wrapper = 0 And rebound = 0 Then If way > 0 And st = k Or way < 0 And st - 1 + j = LtMargin Then OffScrn = -1
    If way > 0 And OffScrn = 0 Then If st = k Then st = LtMargin + 1 - j + wrapper Else st = st + 1
    If way < 0 And OffScrn = 0 Then If st - 1 + j = LtMargin Then st = k - wrapper Else st = st - 1
    For i = 0 To repeat: Locate y + i, LtMargin: Print a;: Next
End Sub

@NakedApe Yeah, I hear you. At some point I should be able to work the base into that marquee lib and eliminate the need to press keys to move. I'm not sure I'll like it any better, but I'd like to see the effect play out, and it's a no brainer if I ever want to buy a couple of joysticks and code them into the routine.

Pete
Shoot first and shoot people who ask questions, later.
Reply
#12
Quote:@bplus Hey man, my points aren't here man! You must have had one of my senior moments!

Ooops I know I typed a comment must of forgot the button. dang I was hoping I would put you to 150.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Space Ship Game aadityap0901 4 769 12-26-2024, 02:13 AM
Last Post: bplus
  The Space Globe NakedApe 4 1,025 09-04-2024, 10:49 PM
Last Post: bplus
  In the spirit of Terry's Tutorials - GUARDIAN Alien Space Ship Game Pete 24 4,191 10-18-2022, 05:16 PM
Last Post: Pete
  Space Lander james2464 22 4,104 10-01-2022, 01:23 AM
Last Post: TerryRitchie
  Space(d) Invaders! Cobalt 2 1,006 07-28-2022, 02:24 AM
Last Post: madscijr

Forum Jump:


Users browsing this thread: