3rd Person Camera by Virtual Games21st May 2006 14:12
|
---|
Summary Simple 3rd Person Camera Description A Simple 3rd Person Camera that is usable with ALL game types including flight sims and rpgs. Just input the object to track, the distance, the camera to use, height and your done. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com ` a simple 3rd person camera ` By AV Games ` free for commercial or non-commercial use ` ` you can use this function for ANY game including flight sims thats not well done in set camera to follow command ` rem a testing of the function rem --- rem build a simple enviroment build_simple_enviroment() rem do-loop do third_person_camera(1,0,object size(1)*3,25) position object 1,object position x(1),get ground height(1,object position x(1),object position z(1))+(object size y(1)/2),object position z(1) gosub move_object loop rem build a simple enviroment function build_simple_enviroment() rem make player make object cube 1,10 rem make an enviroment (matrix) and color with green color make matrix 1,1000,1000,10,10 rem randomize matrix randomize matrix 1,100 rem color matrix cls rgb(10,244,10) ink rgb(60,185,10),0 for a=1 to 6000 dot rnd(100),rnd(100) next a get image 1,0,0,100,100 cls rgb(0,0,0) prepare matrix texture 1,1,16,16 rem update matrix update matrix 1 rem position player position object 1,500,0,500 endfunction move_object: if spacekey()=1 then move object 1,0.5 if leftkey()=1 then turn object left 1,1 if rightkey()=1 then turn object right 1,1 return rem --- rem end of testing rem the function rem use 0 for cam# if using default camera function third_person_camera(obj#,cam#,dist#,height#) rem this sets camera's x angle back to 0 pitch camera up height# rem positions camera in object position position camera cam#,object position x(obj#),object position y(obj#),object position z(obj#) rem rotate camera to object angles set camera to object orientation cam#,obj# rem tilt camera pitch camera down height# rem move camera at a distance away move camera -dist# endfunction |