Hiya I'm preaty new to Dark basic but not to other programing languages and i was trying out the FPS tutorial that comes with Dark basic and came up with a error.
On my line line 49 of my code I get the error shown in the title. I was wondering what could possibly cause this?
here is what my code looks like so far.
rem TUT3A
rem Initial settings
sync on : sync rate 100
backdrop off : hide mouse
rem TUT4C
rem Select font
set text font "arial" : set text size 16
set text to bold : set text transparent
rem Loading prompt
sync : center text screen width() / 2,screen height() / 2, "LOADING" : sync
rem Load all media for game
gosub _load_game
rem Setup all objects for game
gosub _setup_game
rem TUT3B
rem Game loop
do
rem Control game elements
gosub _control_player
gosub _control_gunandbullet
gosub _control_enemies
rem Update screen
sync
rem End loop
loop
rem TUT3C
_control_player:
rem TUT5C
rem Control player direction
rotate camera camera angle x(0) + (mousemovey() / 2.0), camera angle y(0) + (mousemovex() / 2.0), 0
rem Control player movement
cx# = camera angle x(0) : cy# = camera angle y(0)
if upkey() = 1 then xrotate camera 0, 0 : move camera 0, 0.2 : xrotate camera 0, cx#
if downkey() = 1 then xrotate camera 0, 0 : move camera 0, -0.2 : xrotate camera 0, cx#
if leftkey() = 1 then yrotate camera 0, cy# - 90 : move camera 0.2 : yrotate camera 0, cy#
if rightkey() = 1 then yrotate camera 0, cy# + 90 : move camera 0.2 : yrotate camera 0, cy#
if wrapvalue(camera angle x(0)) > 40 and wrapvalue(camera angle x(0))180 then xrotate camera 0, 40
if wrapvalue(camera angle x(0)) > 180 and wrapvalue(camera angle x(0))280 then xrotate camera 0, 280
rem Apply simple gravity to player
position camera camera position x(), camera position y() - 0.1, camera position z()
rem TUT5D
rem Player is always focal point of sky
position object SkyObj, camera position x(0, camera position y(), camera position z()
rem Position listener at player for 3D sound
position listener camera position x(), camera position y(), camera position z()
rotate listener camera angle x(), camera angle y(), camera angle z()
rem TUT5B
rem In case of restart
if restart = 1
restart = 0
set bsp collision off 1
rotate camera 0, 0, 0
position camera 2, 2, 2
set bsp camera collision 1, 0, 0.75, 0
endif
return
_control_gunandbullet:
return
_control_enemies:
return
_control_stats:
return
_setup_game:
rem TUT4B
rem Setup camera
set camera range 1,10000
autocam off
rem Setup sky model
set object SkyObj, 1, 0, 0, 0, 0, 0, 0
scale object SkyObj, 20, 20, 20
rem TUT5a
rem Trigger player initialisation
restart = 1
return
_load_game:
rem TUT 4A
rem Load BSP world and sky model
load bsp "C:\Program Files\The Game Creators\Dark Basic Professional Online\Projects\tutorial\world\ikzdm1.pk3","ikzdm1.bsp"
SkyObj = 1 : load object "C:\Program Files\The Game Creators\Dark Basic Professional Online\Projects\tutorial\models\sky\am.x", SkyObj
return