TGC Codebase Backup



Space Fighter by Kequor

11th Feb 2004 11:13
Summary

This is made only with what with Darkbasic. So you don't need any thing that you don't have. It can be easily made so that you can go forward. So it might be useful in plane/space



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `set up the program
sync on
sync rate 40
hide mouse
autocam off

make matrix 1,1000,1000,50,50

`set fog properties
fog on
fog distance 1000
fog color RGB(128,128,255)

`set light properties
set ambient light 10
color ambient light RGB(0,0,160)

`make a light
make light 1
set point light 1,250,250,250
color light 1,RGB(255,255,100)

`make a temporary player object
load object "SPCVEH08.x",1
xrotate object 1,90
yrotate object 1,270
zrotate object 1,100

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,180
yrotate object 1,90
zrotate object 1,190
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#

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),50)
cz#=newzvalue(z#,wrapvalue(a#+180),50)
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