Hi all, this post is going to track my progress from a DBPro newbie to a pro. I'm going to make games starting from the uber easy to more professional games. Here's a list of what I plan to make (to be edited in the future):
1. Number Guessing Game
Status: Complete, with source code below.
flash = 0
guesses = 10
wins = 0
guess$ = ""
dim guesslist(10, 1)
do
cls
gosub DrawTitle
ink rgb(255,255,255), rgb(0,0,0)
center text 512, 300, "Welcome to Number Guessing!"
flash = flash + 1
if flash = 100
flash = 0
endif
if flash >= 50
ink rgb(100,100,100), rgb(0,0,0)
endif
center text 512, 324, "Press a key when you're ready to play."
if scancode() > 0
exit
endif
loop
gosub ChooseNumber
do
cls
gosub DrawTitle
ink rgb(0,0,255), rgb(0,0,0)
gosub DrawGuesses
center text 512, 600, "Guesses Remaining: " + str$(guesses)
center text 512, 624, "Wins: " + str$(wins)
ink rgb(0,255,0), rgb(0,0,0)
center text 512, 100, "Press ESC at any time to exit."
ink rgb(255,255,255), rgb(0,0,0)
center text 512, 320, "Okay, I've got a number between 1 and 100."
center text 512, 340, "What is your guess?"
set cursor 512-(text width("Your guess: 100")/2), 360
input "Your guess: ";guess$
center text 512, 380, "You guessed " + guess$
center text 512, 400, "Press a key to see how you did..."
wait key
cls
gosub DrawTitle
guesslist(guesses) = val(guess$)
if val(guess$) = number
wins = wins + 1
cls
flash = 0
while scancode() > 0
endwhile
do
cls
gosub DrawTitle
set text size 50
ink rgb(255,0,0), rgb(0,0,0)
flash = flash + 1
if flash = 50
flash = 0
endif
if flash >= 25
ink rgb(255,255,255), rgb(0,0,0)
endif
center text 512, 340, "YOU WIN!"
set text size 12
ink rgb(255,255,255), rgb(0,0,0)
center text 512, 415, "Press any key to continue"
if scancode() > 0
exit
endif
loop
gosub Reset
else
if val(guess$) < number
center text 512, 320, "You guessed too low."
guesslist(guesses,1) = 1
guesses = guesses - 1
endif
if val(guess$) > number
center text 512, 320, "You guessed too high."
guesslist(guesses,1) = 2
guesses = guesses - 1
endif
if guesses <= 0
cls
flash = 0
while scancode() > 0
endwhile
do
cls
gosub DrawTitle
set text size 50
ink rgb(255,0,0), rgb(0,0,0)
flash = flash + 1
if flash = 50
flash = 0
endif
if flash >= 25
ink rgb(255,255,255), rgb(0,0,0)
endif
center text 512, 340, "YOU LOSE!"
set text size 12
ink rgb(255,255,255), rgb(0,0,0)
center text 512, 415, "Press any key to continue"
if scancode() > 0
exit
endif
loop
gosub Reset
else
center text 512, 340, "Press any key to try again."
wait key
endif
endif
loop
Reset:
while scancode() > 0
endwhile
for i = 1 to 10
guesslist(i) = 0
guesslist(i, 1) = 0
guesses = 10
next i
gosub ChooseNumber
return
DrawGuesses:
center text 200, 200, "Numbers You've Guessed:"
for i = 1 to 10
if guesslist(i,1) > 0
if guesslist(i,1) = 1
center text 200, 360-(i*14), str$(guesslist(i)) + ": Too Low"
endif
if guesslist(i,1) = 2
center text 200, 360-(i*14), str$(guesslist(i)) + ": Too High"
endif
endif
next i
return
DrawTitle:
ink rgb(255,0,0), rgb(0,0,0)
set text size 32
center text 512, 0, "Number Guessing Game"
ink rgb(255,255,255), rgb(0,0,0)
set text size 12
return
ChooseNumber:
number = rnd(100)
return
2. 2D Pong
3. 2D Shoot 'Em Up