Hello,
I just registered to this forum today because I am having a bit of trouble with a game project I am working on for a class that I am taking. I just started it, and I am just trying to get it to compile for the first time. I'm not very proficient with DarkBasic, so please bare with me. When I compile this code, I just get a black screen. Now i realize that my code doesn't actually do anything besides display text at the moment, but I just want to get this part working before I move on. Here is my code so far...
REM Project: FinalProject
REM Created: 12/5/2006 4:51:24 PM
REM
REM ***** Main Source File *****
REM
rem constants
global PLAYER_IMAGE = 1
global WHITE_PLANE_IMAGE = 2
global TWIN_PROP_PLANE_IMAGE = 3
global WATER_PLANE_IMAGE = 4
global BOSS1_IMAGE = 10
global BOSS2_IMAGE = 11
global BOSS3_IMAGE = 12
global BOSS4_IMAGE = 13
global MONEY_IMAGE = 20
global HEALTH10_IMAGE = 21
global HEALTH20_IMAGE = 22
global HEALTH50_IMAGE = 23
global HEALTH100_IMAGE = 24
global SHIELD_IMAGE = 25
global BIG_EXPLOSION_IMAGE = 30
global SMALL_EXPLOSION_IMAGE = 31
global RIFLE_IMAGE = 41
global MISSILE_IMAGE = 42
global ENERGYBALL_IMAGE = 43
global RIFLE_SPRITE = 1000
global MISSILE_SPRITE = 2000
global ENERGYBALL_SPRITE = 3000
global OCEAN_BITMAP = 50
global MENU_IMAGE = 51
rem *****************************************************
rem gamestate values
rem 0 = game menu
rem 1 = playing game
rem 2 = game won
rem 3 = game lost
rem 4 = quit
global gameState = 0
global level = 1
global score as integer = 0
global lives as integer = 3
rem keep track of amount of bullets on screen
global totalRifle as integer = 0
global totalMissile as integer = 0
global totalEnergyBall as integer = 0
global playerRifle as integer = 0
global playerMissile as integer = 0
global playerEnergyBall as integer = 0
global enemyRifle as integer = 0
global enemyMissile as integer = 0
global enemyEnergyBall as integer = 0
sync on
sync rate 60
disable escapekey
ink rgb(255,0,0),rgb(0,67,171)
set text size 12
set text font "Times New Roman"
loadShips()
loadBosses()
loadPowerUps()
loadBullets()
loadBitmaps()
set current bitmap 0
repeat
cls
center text screen width()/2, screen height()/2, "Press the space bar to start. At anytime, press the escape key to quit the game."
if escapekey() = 1
gameState = 4
endif
until spacekey() = 1 or gameState = 4
if gameState = 4
end
endif
rem ****************************************************
gameState = 1
START:
REPEAT
cls
set current bitmap OCEAN_BITMAP
repeat
cls
checkInput()
until level = 2 or gameState = 2 or gameState = 3 or gameState = 4
UNTIL gameState = 4
gameOver()
end
function loadShips()
load image "player.bmp",PLAYER_IMAGE,
load image "smallwhite.bmp", WHITE_PLANE_IMAGE
load image "twinprop.bmp", TWIN_PROP_PLANE_IMAGE
load image "waterplane.bmp", WATER_PLANE_IMAGE
endfunction
function loadBosses()
load image "boss1.bmp", BOSS1_IMAGE
load image "boss2.bmp", BOSS2_IMAGE
load image "boss3.bmp", BOSS3_IMAGE
load image "boss4.bmp", BOSS4_IMAGE
endfunction
function loadPowerUps()
load image "money.bmp", MONEY_IMAGE
load image "health10.bmp", HEALTH10_IMAGE
load image "health20.bmp", HEALTH20_IMAGE
load image "health50.bmp", HEALTH50_IMAGE
load image "health100.bmp", HEALTH100_IMAGE
load image "shield.bmp", SHIELD_IMAGE
endfunction
function loadBullets()
load image "riflebullet.bmp", RIFLE_IMAGE
load image "missile.bmp", MISSILE_IMAGE
load image "energyball.bmp", ENERGYBALL_IMAGE
endfunction
function loadBitmaps()
load bitmap "ocean.bmp", OCEAN_BITMAP
endfunction
function checkInput()
if escapekey() = 1
gameState = 4
endif
endfunction
function gameOver()
if gameState = 2
do
set current bitmap 0
cls
center text screen width()/2, screen height()/2, "Congradulations on beating the game. Your score was " + str$(score)
center text screen width()/2 , screen height()/2 + 50, "Press the escape key to quit, or press the space bar to play again."
if spacekey() = 1
goto START
endif
if escapekey() = 1
end
endif
loop
endif
if gameState = 3
do
set current bitmap 0
cls
center text screen width()/2, screen height()/2, "You lose. Your score was " + str$(score)
center text screen width()/2 , screen height()/2 + 50, "Press the escape key to quit, or press the space bar to play again."
if spacekey() = 1
goto START
endif
if escapekey() = 1
end
endif
loop
endif
if gameState = 4
do
set current bitmap 0
cls
center text screen width()/2, screen height()/2, "Thank you for playing. Your score was " + str$(score)
center text screen width()/2 , screen height()/2 + 50, "Press the escape key to quit, or press the space bar to play again."
if spacekey() = 1
goto START
endif
if escapekey() = 1
end
endif
loop
endif
endfunction
Like I said, whenever I run this code, I just get a blank screen. I know it has something to do with they way I am trying to get the text onto the screen, because the functions that I have put into the program regarding the escapekey still work correctly. I think it must have something to do with the set current bitmap command. I guess I'm a little fuzzy on what this command actually does. If you guys could help me out, I would really appreciate it.
Thanks in advance