Camera Control Code by Alexb Orsova8th Dec 2005 16:33
|
---|
Summary An advanced camera system that's really easy to use. Rotates on x and y axes and also has zoom. Description The camera focuses on the point specified by the ox#, oy#, oz# variables. Zoom max and min is controlled by the camera_zoom_min# and camera_zoom_max# variables. The speed at which the camera moves and zoomes is controlled by the camera_zoom# variable. The starting angles are specified by the camera_angle_x# and camera_angle_y# variables. The starting zoom is specified by the camera_zoom# variable. If you use this system a little bit of credit would be nice. Thanks Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com rem Camera Angles camera_angle_x# = 90 camera_angle_y# = 0 camera_zoom# = 100 rem Object Position ox# = 0 : oy# = 0 : oz# = 0 rem Camera Zoom camera_zoom_min# = 20 : camera_zoom_max# = 200 rem Camera Speed camera_speed# = 0.5 Do rem handle controls if keystate(200) = 1 then camera_angle_x# = camera_angle_x# + camera_speed# if keystate(208) = 1 then camera_angle_x# = camera_angle_x# - camera_speed# if keystate(205) = 1 then camera_angle_y# = camera_angle_y# + camera_speed# if keystate(203) = 1 then camera_angle_y# = camera_angle_y# - camera_speed# if keystate(78) = 1 then camera_zoom# = camera_zoom# - camera_speed# if keystate(74) = 1 then camera_zoom# = camera_zoom# + camera_speed# rem wrap camera angles camera_angle_x# = wrapvalue(camera_angle_x#) camera_angle_y# = wrapvalue(camera_angle_y#) if camera_zoom# > camera_zoom_max# then camera_zoom# = camera_zoom_max# if camera_zoom# < camera_zoom_min# then camera_zoom# = camera_zoom_min# rem Update Camera position camera ox#, oy#, oz# rotate camera camera_angle_x#, camera_angle_y#, 0 move camera camera_zoom# - (camera_zoom# * 2) rem Refresh Screen sync Loop |