hello toulis i will try to help you with your questions.
1- yes you can make a function to handle the camera movement and it is best outside the main loop so that you can easily track the syntax of the program. I would have this as follows.
sync on : sync rate 60
rem main loop
do
cam_control()
sync
loop
function cam_control()
if upkey() = 1
playerx# = newxvalue(playerx#,player_yangle#,movespeed#)
playerz# = newzvalue(playerz#,player_yangle#,movespeed#)
else
if downkey() = 1
playerx# = newxvalue(playerx#,player_yangle#,-movespeed#/2)
playerz# = newzvalue(playerz#,player_yangle#,-movespeed#/2)
endif
endif
if rightkey() = 1
playerx# = newxvalue(playerx#,player_yangle#+90,movespeed#/2)
playerz# = newzvalue(playerz#,player_yangle#+90,movespeed#/2)
else
if leftkey() = 1
playerx# = newxvalue(playerx#,player_yangle#-90,movespeed#/2)
playerz# = newzvalue(playerz#,player_yangle#-90,movespeed#/2)
endif
endif
player_yangle# = player_yangle#+(look_speed#*mousemovex())
player_xangle# = player_xangle#+(look_speed#*mousemovey())
position camera playerx#,playery#,playerz#
rotate camera player_xangle#,player_yangle#,0
endfunction
You would need to add checks to stop camera xangle being >90 or <-90 and to put values in look_speed# and move_speed#
2 - you can make a dll with C++ and use it in DBPRO but I don't know much of C++
3 - you can make a command for gravity. You would need to put your entities in an array to hold data on the effect of gravity
type object_gravity
posy as float
gravity_pull as float
above_ground as boolean
endtype
global dim objects(x) as object_gravity
global gravity_force as float : gravity_force = 0.2
sync on : sync rate 60
do
if objects(object_no).above_ground = 1
set_object_gravity(object_no)
endif
sync
loop
function set_object_gravity(object_no)
inc objects(object_no).gravity_pull,gravity_force
dec objects(object_no).posy,objects(object_no).gravity_pull
endfunction
This is only a very simple way of demonstrating it. You would need to check the ground height (perhaps of the terrain?) to determine whether to apply gravity on the object. Ive also assumed that the array references correspond to the object number i.e objects(15).gravity_pull refers to object 15
I hope this all makes sense