TGC Codebase Backup



changing to a different type of gun.machine gun/shotgun properties by ben d hi harry by super slick hey harry!!!

7th Jul 2004 11:20
Summary

this is what iv got so far on a game im working on its not far yet gut it can change weapon between machine gun and shotgun. it also has medal of honor like controls



Description

it shows all the numbers that wont be shown eventualy these are variables. the "file" variable shows images on the bottom i have taken these out on the code because the files they will be no use to you.its very basic compared to what it looks to me with the files it has 10 guns and has pictures of all at the bottom. and the matrix on this isnt textured also the gun is only a non changing cube but it still shows how you can change type of shot on a mouse click



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

hide mouse
file=2
y=450
x=1
lenth=100 
lives=5
life=100
size=1.5
sizes=3

make object cube 1,size
XRotate Object 1,90
Fix object pivot 1
Scale object 1,100,100,500
position object 1,0,-7,15
lock object on 1

Rem Make bullet
Make Object Sphere 2,sizes
Hide Object 2


Rem make matrix 
Make matrix 1,10000,10000,20,20


Do

 OldCamAngleY# = CameraAngleY# 
 OldCamAngleX# = CameraAngleX# 

 CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2) 
 CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2) 

 Rem  Control input for camera 
 If Upkey()=1 
  XTest# = Newxvalue(X#,CameraAngleY#,10) 
  ZTest# = Newzvalue(Z#,CameraAngleY#,10) 
  If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000 
   X#=XTest# 
   Z#=ZTest# 
  Endif 
 Endif

if Mouseclick()=1 and gun=50
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
If BulletLife > 0
	Dec BulletLife
	Move object 2,20
	If BulletLife = 0 then Hide object 2
Endif
if Mouseclick()=1 and gun=60
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
If BulletLife > 0
	Dec BulletLife
	Move object 2,20
	If BulletLife = 0 then Hide object 2
Endif
if Mouseclick()=1 and gun=70
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
If BulletLife > 0
	Dec BulletLife
	Move object 2,20
	If BulletLife = 0 then Hide object 2
Endif
if Mouseclick()=1 and gun=80
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
If BulletLife > 0
	Dec BulletLife
	Move object 2,20
	If BulletLife = 0 then Hide object 2
Endif
if Mouseclick()=1 and gun=90
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
if Mouseclick()=1 and gun=100
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
If BulletLife > 0
	Dec BulletLife
	Move object 2,20
	If BulletLife = 0 then Hide object 2
Endif
if mouseclick()=1 and bulletlife<20 and gun=40 
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
If BulletLife > 0
	Dec BulletLife
	Move object 2,20
	If BulletLife = 0 then Hide object 2
Endif

if mouseclick()=1 and bulletlife<20 and gun=30 
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
If BulletLife > 0
	Dec BulletLife
	Move object 2,20
	If BulletLife = 0 then Hide object 2
Endif
if mouseclick()=1 and bulletlife<20 and gun=20 
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
If BulletLife > 0
	Dec BulletLife
	Move object 2,20
	If BulletLife = 0 then Hide object 2
Endif
if mouseclick()=1 and bulletlife<20 and gun=10 
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
If BulletLife > 0
	Dec BulletLife
	Move object 2,20
	If BulletLife = 0 then Hide object 2
Endif
if mouseclick()=1 and bulletlife<20 and gun=0 
	Position object 2,X#,y#+5,z#
	Set object to camera orientation 2
	BulletLife = lenth
	Show object 2
Endif
If BulletLife > 0
	Dec BulletLife
	Move object 2,20
	If BulletLife = 0 then Hide object 2
Endif
 If Downkey()=1 
  XTest# = Newxvalue(X#,Wrapvalue(CameraAngleY#-180),10) 
  ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-180),10) 
  If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000 
   X#=XTest# 
   Z#=ZTest# 
  Endif 
 Endif 
if rightkey()=1 then inc gun,10	
if leftkey()=1 then dec gun,10
set cursor 500,20
print "Lifes: ",lives
set cursor 500,40
print "Health left: ",life
set cursor 500,60
print "gun number: ",gun
print "",lenth
print "",size
print "",sizes 
print "who",file   
if lives=0 then print "game over"
if life=0 then dec lives,1
if gun>100 then gun=0 

 Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24) 
 Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24) 
  

 Y# = Get ground height(1,X#,Z#) 
 Position Camera X#,Y#+50,Z# 

 Rem Refresh Screen 
 Sync 
Loop