TGC Codebase Backup



police car by blood scent

17th Aug 2005 19:51
Summary

a small program that drives around a police car



Description

drives around a car split screen front and back view uses ghosting and textures (need to download) if you have darkmatter,get them from windows exploror then copy and paste into tour project.(natural folder,and "police carh-police car-move.3ds")



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    REM Project: police car
REM Created: 8/15/2005 3:56:10 PM
REM
REM ***** Main Source File *****
REM
REM Project: police car
REM Created: 8/15/2005 3:56:10 PM
REM
REM ***** Main Source File *****

REM initialize

hide mouse
randomize TIMER()
ink 0,0
cls

rem create lighting

make light 2
set spot light 2,360,4
set light range 2,100000
color light 2,rgb(0,0,0)

rem make rearview

make camera 2
color backdrop 2,rgb(0,0,125)
set camera view 2,0,screen height()/2,screen width(),screen height()

rem create a sphere to use over car

make object sphere 5,5
color object 5,rgb(rnd(255),rnd(255),rnd(255))

rem call function to setup demo

loadobjects_textures_world()

rem call function to play the game

control_positions()
end





rem function section

rem function to setup demo

function loadobjects_textures_world
load bitmap "naturalslime2.bmp",3
load bitmap "naturalrust1.bmp",2
load object "police carh-police car-move.3ds",1
clone object 10,1
ghost object on 10
yrotate object 1,180
yrotate object 10,180
loop object 10
loop object 1
fix object pivot 1
fix object pivot 10
make matrix 1,100000,100000,20,40
set current bitmap 3
get image 1,0,0,10,10
set current bitmap 2
get image 2,0,0,10,10
set current bitmap 0
prepare matrix texture 1,1,100000,10000
texture object 5,2
update matrix 1
set camera view 0,0,0,screen width(),screen height()/2
endfunction

rem control positions

function control_positions
do
if leftkey() then a#=a#-0.3
if rightkey() then a#=a#+0.3
spherespin#=spherespin#+0.1
spherespin#=wrapvalue(spherespin#)
xrotate object 5,spherespin#
a#=wrapvalue(a#)
if upkey()=1 then x#=newxvalue(x#,a#,0.05) : z#=newzvalue(z#,a#,0.05)
if downkey() then x# = newxvalue(x#,a#,-0.05) : z# = newzvalue(z#,a#,-0.05)
position object 1,x#,0,z#
position object 10,x#,0,z#+10
position object 5,object position x(1),object position y(1)+10,object position z(1)
yrotate object 1,a# : yrotate object 10,a#
yrotate object 5,a#
set camera to follow object position x(1),object position y(1),object position z(1),180,-20,7,100,1
set camera to follow 2,object position x(1),object position y(1),object position z(1),360,-20,7,100,1
set light to object position 2,1
position light 2,object angle x(5),object angle y(5)+4,object angle z(5)
if escapekey()=1 then exit
loop
endfunction