@chafari
Now I have hopefully attached a working video file. NB! the jagged lines is not easy to see in the video, it's because of the video is compressed.
Here is also the part 1 of my code;
Rem Project: DARK SPACE
Rem Created: Saturday, December 07, 2013
Rem ***** Main Source File *****
maximize window
Sync on
sync rate 60
autocam off
hide mouse
Gosub Objects_Camera
Gosub Intialize_medias
Gosub Players
Gosub Constants
do
Gosub MAIN_GAME_ENGINE
sync
loop
Intialize_medias:
Create animated sprite bg,"BILDER\bg.bmp", 1, 1, Image_bg
return
Constants:
#Constant bg 1
#Constant plyr 2
#Constant Image_plyr 3
#Constant Image_bg 4
return
Players:
Create animated sprite plyr,"BILDER\sprite.bmp", 1, 1, Image_plyr
return
Objects_Camera:
make object box 1,400,1,400
color object 1,rgb(0,255,0)
`helper object
make object sphere 2,1:color object 2,rgb(255,255,0)
`player object
make object box 3,1,5,3
offset limb 3,0,0,2.5,0
color object 3,rgb(255,0,0)
position camera 0,50,0
`Crates
Make object box 5,5,5,3
position object 5, 80, 0,50
color object 5,rgb(0,255,10)
And here is the part 2 (included Source File);
Rem ***** Included Source File *****
MAIN_GAME_ENGINE:
`Texturing object
texture object 1,Image_bg
`camera position before moving
x#=camera position x()
y#=camera position y()
z#=camera position z()
`moving camera 1000 units to get new x,y,z
move camera 1000
lx#=camera position x()
ly#=camera position y()
lz#=camera position z()
`getting camera back to actual posiiton
move camera -1000
`distance by intersect command with old coodinates and new coordinates
dis= intersect object(1,x#,y#,z#,lx#,ly#,lz#)
`camera movements
cam# = 90.001
cam2# = 10.1
if inkey$()="f"
cam# = cam2#
endif
control camera using arrowkeys 0,0.4,0.4
a#=wrapvalue(a#+mousemovex()/2)
rotate camera cam#,a#,0
`positioning object 2 in camera coords and rotating camera angle
position object 2,x#,y#,z#
rotate object 2,cam#,a#,0
move object 2,dis
`forcing player to point and folow helper object if we are into floor area
REM move object 3,0.01 ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
if object collision(2,1) then point object 3,object position x(2),0,object position z(2)
`Object movement
if inkey$()="w" = 1 then move object 3,0.5
`Following camera
X2#=object position X(3)
Y2#=object position Y(3)
Z2#=object position Z(3)
AY#=object angle Y(3)
AX#=object angle X(3)+13
if cam# = cam2#
hide object 2
endif
position camera X2#,Y2#,Z2# `put the camera where the player is
if cam# <> cam2#
yrotate camera AY# `Yrotating the camera to the player's Y angle
endif
move camera -75 `move the camera back a bit
return