Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tiny Space Invaders
#1
Code: (Select All)
_Title "b+ Space Invaders" ' mod of one found at LB
Screen _NewImage(256, 320, 32) ' 32 x 20 chars
_ScreenMove 500, 150
Do
    ReDim A$(4)
    For i = 0 To 4
        A$(i) = "A A A A A A A A " ' len = 16  so make field 32 wide  0 31
    Next
    sy = 19 'ship y
    sx = 14 'ship x    ship is 1 chars wide so mx starts at sx + 1, my sy - 1  sx max = 31
    ax = 0 'left of alien hoard
    ay = 0 'top left of alien  hoard
    adx = 1
    by = ay + 6
    bx = ax + Int(Rnd * 16)
    my = -1
    Do
        Cls 'draw everything
        For i = 0 To 4 'field of A's  alien hoard
            _PrintString (ax * 8, (ay + i) * 16), A$(i)
        Next
        _PrintString (bx * 8, by * 16), "o"
        If my >= 0 Then _PrintString (mx * 8, my * 16), "*"
        _PrintString (sx * 8, sy * 16), "/I\" 'the ship / cannon
        For i = 0 To 4 'field of A's  alien hoard
            If i + ay = my Then
                For j = 1 To Len(A$(i))
                    If ax + j - 1 = mx And Mid$(A$(i), j, 1) = "A" Then Mid$(A$(i), j, 1) = " ": my = -1
                Next
            End If
        Next
        If ((bx >= sx And bx <= sx + 2) And by = sy) Or (ay + 4 = 19) Then Beep: Exit Do ' blew up ship   ' did bomb take out cannon or hoard reach ground
        ax = ax + adx 'update hoard
        If ax < 0 Then
            ay = ay + 1: adx = 1: ax = 0
        ElseIf ax + 16 > 31 Then 'run it back on same line to slow down the crush
            adx = -1: ax = 15
        End If
        by = by + 1 'alien bomb
        If by > 19 Then 'new bomb
            by = ay + 5
            bx = ax + Int(Rnd * 16)
        End If
        If my >= 0 Then my = my - 1 'update bullet ' missile
        If my < ay Then my = -1 ' deactivate after passed horde
        While _MouseInput: Wend
        sx = Int((_MouseX - 8) / 8)
        k$ = InKey$
        If k$ = " " Then
            If my < ay Then mx = sx + 1: my = sy - 1 ' fire cannon  if last missile has past the hoard
        End If
        _Display
        _Limit 5
    Loop
    Sleep
Loop Until _KeyDown(27)

' 2020-11-13 tiny space invaders b+ 2020-11-14

' ========================= Instructions ===================

' mouse to move ship/cannon left and right
' spacebar to fire cannon

'===========================================================

It kinda works might be simplified a bit... Anti-Unseen Machine style no libraries and no special directories LOL!
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
Tiny Space Invaders - by bplus - 09-09-2025, 05:19 PM
RE: Tiny Space Invaders - by bplus - 09-09-2025, 05:32 PM
RE: Tiny Space Invaders - by dbox - 09-09-2025, 08:49 PM
RE: Tiny Space Invaders - by Pete - 09-09-2025, 07:30 PM
RE: Tiny Space Invaders - by bplus - 09-09-2025, 07:35 PM
RE: Tiny Space Invaders - by Unseen Machine - 09-09-2025, 10:21 PM
RE: Tiny Space Invaders - by dbox - 09-09-2025, 10:29 PM
RE: Tiny Space Invaders - by bplus - 09-09-2025, 11:58 PM
RE: Tiny Space Invaders - by Pete - 09-10-2025, 04:12 AM
RE: Tiny Space Invaders - by bplus - 09-10-2025, 02:31 PM
RE: Tiny Space Invaders - by Pete - 09-10-2025, 03:30 PM
RE: Tiny Space Invaders - by bplus - 09-10-2025, 04:08 PM
RE: Tiny Space Invaders - by dbox - 09-10-2025, 05:06 PM
RE: Tiny Space Invaders - by Pete - 09-10-2025, 11:00 PM
RE: Tiny Space Invaders - by dbox - 09-11-2025, 02:52 PM
RE: Tiny Space Invaders - by Pete - 09-11-2025, 04:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Space Invaders knock off to show simple collisions Unseen Machine 10 1,104 09-09-2025, 07:23 PM
Last Post: Pete
  Tiny Maze Maker - ASCII SierraKen 19 1,720 08-09-2025, 11:39 PM
Last Post: SierraKen
  Space Pongy bplus 3 829 11-29-2024, 11:18 PM
Last Post: SierraKen
  Tech Invaders 5 SierraKen 5 1,218 08-12-2024, 01:10 PM
Last Post: Dav
  sweet little circuit game space maker bplus 3 1,234 02-19-2024, 01:27 AM
Last Post: PhilOfPerth

Forum Jump:


Users browsing this thread: 1 Guest(s)