Hi, I am making a 3rd person action/adventure game in Dark Basic. I have a few questions about my code for camera/character control.
This is the code I currently have written:
Character Control:
REM Character Control
if upkey()=1 then move object 1,10
if downkey()=1 then move object 1,-10
if leftkey()=1 then turn object left 1,5
if rightkey()=1 then turn object right 1,5
Camera Control:
REM Camera Control
a#=wrapvalue(a#+mousemovex())
b#=wrapvalue(b#+mousemovey())
position camera 500+(sin(a#)*cos(b#)*500),50+(sin(b#) *500),500+(cos(a#)*cos(b#)*500)
point camera 500,50,500
sync
So, my question is, how can I "attach" the camera to the character, right now the character moves but the camera stays in one spot. I would like to be able to have the camera follow the character when the player uses the arrow keys to move but when they use the mouse the camera moves around the character.
My second question is, how can I make it so that the charater goes up and down with the height of the matrix, right now it just goes right through the hills.
Thank you and I how that I explain myself well enough. Thanks again in advance for any help.
-Sam