TGC Codebase Backup



Best 1st person perspective view for your games by LEAF

2nd Nov 2008 9:45
Summary

A simple 1st person perspective view for your games. NOTE: This is just a camera function so you can't just put this code in DBP and compile.



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    do
rotate camera camera angle x(0)+(mousemovey()/2.5),camera angle y(0)+(mousemovex()/2.5),0
ax# = camera angle x()
ay# = camera angle y()
if upkey() = 1
xrotate camera 0
move camera 5
xrotate camera ax#
endif
if downkey() = 1
xrotate camera 0
move camera - 5
xrotate camera ax#
endif
if leftkey() = 1
yrotate camera ay# - 90
move camera 5
yrotate camera ay#
endif
if rightkey() = 1
yrotate camera ay# + 90
move camera 5
yrotate camera ay#
endif
x# = camera position x()
y# = get ground height(1,x#,z#) + 100
z# = camera position z()
position camera x#,y#,z#
sync
loop