TGC Codebase Backup



Jet Fighter by look i am a newb

31st Jan 2004 10:12
Summary

A jet fighter that moves faster when you press up and slower when you press down.



Description

A jet fighter that moves faster when you press up and slower when you press down.
make sure you have a fighter obj and a floor image



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Sync On 
Sync Rate 30 

hide mouse 

Backdrop on 
Set camera range 1,5000 

Fog on 
Fog distance 4000 
Fog color RGB(128,128,128) 
Color Backdrop RGB(128,128,128) 


rem make sure u have a texture
make matrix 1,10000.0,10000.0,25,25
load bitmap "floor.bmp",1 
get image 1,0,0,256,256
delete bitmap 1
prepare matrix texture 1,1,2,2
randomize matrix 1,50.0
set matrix height 1,12,12,300.0
update matrix 1
rem change it to your obj
load object "f16.x",1
color backdrop 0

rem Create fog (if supported)
fog on

rem Cast dark ambience with a touch of green
set ambient light 25
color ambient light rgb(128,255,64)

rem Rotate and fix data so character faces right way
xrotate object 1,90
yrotate object 1,180
zrotate object 1,180
fix object pivot 1

rem Activate manual sync
sync on

rem Begin loop
do

rem Update character
y#=150
position object 1,x#,y#,z#
yrotate object 1,a#

rem Control camera with arrow keys
if upkey()=0 then x#=newxvalue(x#,a#,10) : z#=newzvalue(z#,a#,10)
if upkey()=1 then x#=newxvalue(x#,a#,20) : z#=newzvalue(z#,a#,20)
if downkey()=1 then x#=newxvalue(x#,a#,-4) : z#=newzvalue(z#,a#,-4)
if leftkey()=1 then a#=wrapvalue(a#-3.0)
if rightkey()=1 then a#=wrapvalue(a#+3.0)


rem Position camera to the back of the character
cx#=newxvalue(x#,wrapvalue(a#+180),200)
cz#=newzvalue(z#,wrapvalue(a#+180),200)
cy#=200
position camera cx#,cy#,cz#

rem Point camera at object
point camera x#,y#,z#

rem Syncronise
sync

rem End loop
loop

rem End the program
end