TGC Codebase Backup



rotation by Anonymous Coder

13th Oct 2012 11:00
Summary

zrotate camera keeping up/down left/right at same screen co/ord



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    REM Project: rotation
REM Created: 10/13/2012 3:27:39 PM
REM
REM ***** Main Source File *****
REM
rem 3d rotation of camera (z) angle*** x/y co-ord stay same

autocam off:set display mode 1024,768,32
rem
make object box 1,10,16,10
z#=-40:m#=.01
rem
do
sc=scancode()
cx#=wrapvalue(camera angle z())
position camera x#,y#,z#
zrotate camera wrapvalue(camera angle z())+r#
rem camera up/down
if sc=80 then x#=x#+m#*cos(cx#+90):y#=y#+m#*sin(cx#+90)
if sc=72 then x#=x#-m#*cos(cx#+90):y#=y#-m#*sin(cx#+90)
rem camera left/right
if sc=75 then x#=x#+m#*cos(cx#):y#=y#+m#*sin(cx#)
if sc=77 then x#=x#-m#*cos(cx#):y#=y#-m#*sin(cx#)
rem rotate camera
if leftkey() then r#=r#+.001
if rightkey() then r#=r#-.001

loop