This was actually my first non-tutorialled game, following the general principles I learned from Tom Mulgrew's tutorials.
dim playerx, playery, playerfacing, lives, score, bulletOnScreen
dim bullety, bulletx, i, bulletdirection, g, j, alienOnScreen(100)
dim alienx(100), alieny(100), rand(2), alienranded(100)
j = 10
score = 0
lives = 3
playery = 16
playerx = 18
playerfacing = 10
bulletOnScreen = false
rand(1) = rnd () % 4 + 1
rand(2) = rnd () % 2 + 1
for g = 1 to j
alienOnScreen(g) = true
next
for g = 1 to j
alienranded(g) = false
next
TextMode (TEXT_BUFFERED)
while true
if ScanKeyDown (VK_UP) and playery > 0 then
playery = playery - 1
playerfacing = 10
endif
if ScanKeyDown (VK_DOWN) and playery < 32 then
playery = playery + 1
playerfacing = 20
endif
if ScanKeyDown (VK_LEFT) and playerx > 0 then
playerx = playerx - 1
playerfacing = 30
endif
if ScanKeyDown (VK_RIGHT) and playerx < 37 then
playerx = playerx + 1
playerfacing = 40
endif
if ScanKeyDown (VK_SPACE) then
bulletOnScreen = true
bulletdirection = playerfacing
if playerfacing = 10 then
bullety = playery - 1
bulletx = playerx + 1
endif
if playerfacing = 20 then
bullety = playery + 1
bulletx = playerx + 1
endif
if playerfacing = 30 then
bullety = playery
bulletx = playerx - 1
endif
if playerfacing = 40 then
bullety = playery
bulletx = playerx + 3
endif
endif
cls
color (255, 255, 255)
locate 0, 0: print "Score: " + score
locate 0, 30: print "Lives: " + lives
color (255, 255, 255)
locate playerx, playery: if playerfacing = 10 then
print "<|>"
else
if playerfacing = 20 then
print "<|>"
endif
if playerfacing = 30 then
print "<->"
endif
if playerfacing = 40 then
print "<->"
endif
endif
for g = 1 to j
if alienranded(g) = false then
rand(1) = rnd () % 4 + 1
rand(2) = rnd () % 2 + 1
if rand(1) = 1 then
alienx(g) = rnd () % 37 + 1
if rand(2) = 1 then
alieny(g) = 0
endif
if rand(2) = 2 then
alieny(g) = 32
endif
endif
if rand(1) = 2 then
alieny(g) = rnd () % 32 + 1
if rand(2) = 1 then
alienx(g) = 0
endif
if rand(2) = 2 then
alienx(g) = 38
endif
endif
alienranded(g) = true
endif
next
for g = 1 to j
if alienx(g) > playerx + 1 then
alienx(g) = alienx(g) - 1
endif
if alienx(g) < playerx + 1 then
alienx(g) = alienx(g) + 1
endif
if alieny(g) > playery then
alieny(g) = alieny(g) - 1
endif
if alieny(g) < playery then
alieny(g) = alieny(g) + 1
endif
next
for g = 1 to j
if alienOnScreen(g) = true then
locate alienx(g), alieny(g): print "O"
endif
next
for g = 1 to j
if bulletOnScreen = true and bulletx = alienx(g) and bullety = alieny(g) then
alienOnScreen(g) = false
score = score + 100
endif
next
if bulletOnScreen = true then
if bulletdirection = 10 then
for i = 1 to 0 + playery
locate bulletx, bullety: print "|"
bullety = bullety - 1
DrawText ()
next
endif
if bulletdirection = 20 then
for i = 1 to 25 - playery
locate bulletx, bullety: print "|"
bullety = bullety + 1
DrawText ()
next
endif
if bulletdirection = 30 then
for i = 1 to 0 + playerx
locate bulletx, bullety: print "-"
bulletx = bulletx - 1
DrawText ()
next
endif
if bulletdirection = 40 then
for i = 1 to 39 - playerx
locate bulletx, bullety: print "-"
bulletx = bulletx + 1
DrawText ()
next
endif
if bullety < 0 or bullety > 25 or bulletx < 0 or bulletx > 39 then
bulletOnScreen = false
endif
endif
for g = 1 to j
if alienx(g) = playerx + 1 and alieny(g) = playery then
locate playerx, playery: print "///"
locate playerx, playery: print "\\\"
locate playerx, playery: print "///"
locate playerx, playery: print "\\\"
for g = 1 to j
alienranded(g) = false
next
playery = 16: playerx = 18
lives = lives - 1
Sleep (100)
endif
next
DrawText ()
Sleep (75)
Wend
Obviously, it never came out how I planned. :P