So I have this code, and I am trying to get the camera to follow the character, and it does! As long as the character doesn't jump or fall.... if the player falls, then the camera is then like, 100 feet below the character!! BAH!!
here is my code. If you would like to try it out to see what i mean, pleaze feel free to. Just get read of all of the texturing stuff.
autocam off
sync on
sync rate 60
hide mouse
gosub _player
gosub _level1
load image "Media\grass_T.bmp",1
do
texture object 100,1
if upkey()=1 then move object 1,0.8
if leftkey()=1 then yrotate object 1,wrapvalue(object angle y(1)-2.5)
if rightkey()=1 then yrotate object 1,wrapvalue(object angle y(1)+2.5)
if spacekey()=1 and playergrav#=0.0 then playergrav#=2.0
angle#=object angle y(1)
camdist#=25.0 : camhigh#=posy#+8.0 : camfade#=3.5
set camera to follow posx#,posy#-20,posz#,angle#,camdist#,camhigh#,camfade#,1
posx#=object position x(1)
posy#=object position y(1)
posz#=object position z(1)
cposx#=camera position x()
cposy#=camera position y()+10
cposz#=camera position z()
position object 2,cposx#,cposy#,cposz#
playergrav#=playergrav#-0.1
posy#=posy#+playergrav#
position object 1,posx#,posy#,posz#
if object collision(1,0)>0
dec posx#,get object collision x()
dec posy#,get object collision y()
dec posz#,get object collision z()
if get object collision y()<0 then playergrav#=0.0
endif
if object collision(2,0)>0
dec cposx#,get object collision x()
dec cposy#,get object collision y()
dec cposz#,get object collision z()
endif
position camera cposx#,cposy#,cposz#
position object 1,posx#,posy#,posz#
xrotate camera 15
sync
loop
_player:
make object box 1,10,10,10
color object 1,rgb(255,0,255)
position object 1,0,0,0
make object collision box 1,-5,-5,-5,5,5,5,0
make object cube 2,1
make object collision box 2,-0.5,-0.5,-0.5,0.5,0.5,0.5,0
hide object 2
return
````````````````````````````
```````````Level1```````````
````````````````````````````
_level1:
make object box 100,500,10,500
position object 100,0,-100,0
make object collision box 100,-250,-5,-250,250,5,250,0
scale object texture 100,10,10
make object box 101,20,5,30
position object 101,0,-20,0
make object collision box 101,-10,-5,-15,10,5,15,0
return
Why do they turn against me? Especially when i need them the most?