zzz... I did not use the build in collision system in dbc. I found out it is to slow so i used some custom made collision system. I would download sparky´s dll but i can not use dlls in version 1.08. you need version 1.13. I have tryed updating but it does not work.
Here is to code it you want an look. It is an bit messy. I have just started an new version i will finished it in an day or two.
gosub _settings
gosub _Veribles
gosub _load_Bitmaps
gosub _Load_Objects
gosub _Load_Sounds
gosub _Make_Level
hide object 99
do
if scancode() = 0 then key_hold = 0
gosub _Player_Controls
gosub _Zombies_Controls
gosub _Camra_Controls
text 5 , 5 , "FPS: " + str$( screen fps() )
text 5 , 30 , "X: " + str$( Player_Data#(1) )
text 5 , 50 , "Y: " + str$( Player_Data#(2) )
text 5 , 70 , "Z: " + str$( Player_Data#(3) )
text 5 , 90 , "A: " + str$( Player_Data#(4) )
sync
loop
_Zombies_Controls:
rem Zombie_Data(20,10)
rem 2000 + N
rem setup Starting Position
FOR N = 1 to MAX_Zombies
IF Zombie_Data#( N , 1 ) = 0
Zombie_Data#( N , 1 ) = 1
Zombie_Data#( N , 2 ) = RND(10000)
Zombie_Data#( N , 3 ) = 0
Zombie_Data#( N , 4 ) = RND(10000)
Zombie_Data#( N , 7 ) = TIMER() : rem animation timer
Zombie_Data#( N , 8 ) = 0 : rem frame count
endif
IF TIMER() >= Zombie_Data#( N , 7 ) + 300
IF Zombie_Data#( N , 2 ) <> Zombie_Data#( N , 5 ) and Zombie_Data#( N , 4 ) <> Zombie_Data#( N , 6 )
Zombie_Data#( N , 7 ) = TIMER()
Zombie_Data#( N , 8 ) = Zombie_Data#( N , 8 ) + 1
IF Zombie_Data#( N , 8 ) = 5 then Zombie_Data#( N , 8 ) = 1
rem TEXTURE OBJECT 2100 + N , 2
IF Zombie_Data#( N , 8 ) = 1 then TEXTURE OBJECT 2100 + N , 2
IF Zombie_Data#( N , 8 ) = 2 then TEXTURE OBJECT 2100 + N , 3
IF Zombie_Data#( N , 8 ) = 3 then TEXTURE OBJECT 2100 + N , 2
IF Zombie_Data#( N , 8 ) = 4 then TEXTURE OBJECT 2100 + N , 4
else
Zombie_Data#( N , 8 ) = 1 : TEXTURE OBJECT 2100 + N , 2
endif
endif
rem old data
Zombie_Data#( N , 5 ) = Zombie_Data#( N , 2 ) : Zombie_Data#( N , 6 ) = Zombie_Data#( N , 4 )
rem handle the ramp
IF Zombie_Data#( N , 2 ) => 3200 and Zombie_Data#( N , 2 ) <= 3760
if Zombie_Data#( N , 4 ) >= 1850 and Zombie_Data#( N , 4 ) <= 2150
Zombie_Data#( N , 3 ) = ( 3760 - Zombie_Data#( N , 2 ) ) * 0.94
endif
endif
rem change the player Y to the ground
IF Zombie_Data#( N , 2 ) => 3760 and Zombie_Data#( N , 2 ) <= 3900
IF Zombie_Data#( N , 4 ) >= 1850 and Zombie_Data#( N , 4 ) <= 2150
IF Zombie_Data#( N , 3 ) >= 0 and Zombie_Data#( N , 3 ) <= 100
Zombie_Data#( N , 3 ) = 0
endif
endif
endif
IF Zombie_Data#( N , 3 ) > 451 then Zombie_Data#( N , 3 ) = 450
NEXT N
FOR N = 1 to MAX_Zombies
zombie_number = 2000 + N
rem move zombie
zombie_angle# = wrapvalue( OBJECT ANGLE Y( zombie_number ) + 180 )
Zombie_Data#( N , 2 ) = newxvalue( Zombie_Data#( N , 2 ) , zombie_angle# , 6 )
Zombie_Data#( N , 4 ) = newZvalue( Zombie_Data#( N , 4 ) , zombie_angle# , 6 )
rem check for block collision
FOR B = 100 to 100 + ( Number_OF_Objects - 1 )
PLAN_NUMBER = 2100 + N
Object_Size_X# = 50 + Object_Sizes( B - 99 , 1 )
Object_Size_Y# = 50 + Object_Sizes( B - 99 , 2 )
Object_Size_Z# = 50 + Object_Sizes( B - 99 , 3 )
disx# = abs( object position x( PLAN_NUMBER ) - object position x( B ) )
disY# = abs( object position y( PLAN_NUMBER ) - object position y( B ) )
disz# = abs( object position z( PLAN_NUMBER ) - object position z( B ) )
if disY# < Object_Size_Y#
rem if disx# < Object_Size_X# and disz# < Object_Size_Z# and disY# < Object_Size_Y#
rem test X
position object PLAN_NUMBER , Zombie_Data#( N , 2 ) , Zombie_Data#( N , 3 ) , Zombie_Data#( N , 6 )
disx# = abs( object position x( PLAN_NUMBER ) - object position x( B ) )
disz# = abs( object position z( PLAN_NUMBER ) - object position z( B ) )
if disx# < Object_Size_X# and disz# < Object_Size_Z# then Zombie_Data#( N , 2 ) = Zombie_Data#( N , 5 )
rem test Z
position object PLAN_NUMBER , Zombie_Data#( N , 5 ) , Zombie_Data#( N , 3 ) , Zombie_Data#( N , 4 )
disx# = abs( object position x( PLAN_NUMBER ) - object position x( B ))
disz# = abs( object position z( PLAN_NUMBER ) - object position z( B ))
if disx# < Object_Size_X# and disz# < Object_Size_Z# then Zombie_Data#( N , 4 ) = Zombie_Data#( N , 6 )
rem endif
endif
NEXT B
FOR B = 1 to MAX_Zombies
rem zombies collision with each other
IF N <> B
PLAN_NUMBER_2 = 2100 + B : PLAN_NUMBER = 2100 + N
Object_Size_X# = 150 : Object_Size_Z# = 150
disY# = abs( object position y( PLAN_NUMBER ) - object position y( PLAN_NUMBER_2 ) )
if disY# < 50
rem test X
disx# = abs( object position x( PLAN_NUMBER ) - object position x( PLAN_NUMBER_2 ) )
disz# = abs( object position z( PLAN_NUMBER ) - object position z( PLAN_NUMBER_2 ) )
if disx# < Object_Size_X# and disz# < Object_Size_Z# then Zombie_Data#( N , 2 ) = Zombie_Data#( N , 5 )
rem test Z
disx# = abs( object position x( PLAN_NUMBER ) - object position x( PLAN_NUMBER_2 ))
disz# = abs( object position z( PLAN_NUMBER ) - object position z( PLAN_NUMBER_2 ))
if disx# < Object_Size_X# and disz# < Object_Size_Z# then Zombie_Data#( N , 4 ) = Zombie_Data#( N , 6 )
endif
endif
NEXT B
NEXT N
FOR Q = 1 to MAX_Zombies
zombie_number = 2000 + Q
PLAN_NUMBER = 2100 + q
Position object zombie_number , Zombie_Data#( Q , 2 ) , Zombie_Data#( Q , 3 ) , Zombie_Data#( Q , 4 )
Position object PLAN_NUMBER , Zombie_Data#( Q , 2 ) , Zombie_Data#( Q , 3 ) + 100, Zombie_Data#( Q , 4 )
rem IF TIMER() >= Zombie_Data#( Q , 7 ) + 1000
rem Zombie_Data#( Q , 7 ) = TIMER()
POINT OBJECT zombie_number , Player_Data#(1), 0 , Player_Data#(3)
zombie_angle# = OBJECT ANGLE Y( zombie_number )
YROTATE OBJECT zombie_number , wrapvalue( zombie_angle# + 180 )
YROTATE OBJECT PLAN_NUMBER , wrapvalue( zombie_angle# + 180 )
rem endif
NEXT Q
return
_Load_Sounds:
load sound "SFX\gunshot.wav" , 1
Load sound "SFX\ricochet.wav" , 2
LOad sound "SFX\scream1.wav" , 3
return
_Camra_Controls:
Camera_angle# = wrapvalue( curveangle( Player_Data#(4) , Camera_angle# ,10.0 ) )
camera_pos#(1) = newxvalue( Player_Data#(1) , wrapvalue( Camera_angle# + 180 ) , 200 )
camera_pos#(3) = newzvalue( Player_Data#(3) , wrapvalue( Camera_angle# + 180 ) , 200 )
camera_pos#(2) = Player_Data#(2) + 300.0
position camera camera_pos#(1) , camera_pos#(2) , camera_pos#(3)
point camera Player_Data#(1) , Player_Data#(2) + 200, Player_Data#(3)
return
_Player_Controls:
Player_Move = 0
FOR N = 1 to 5 : Old_Player_Data#(N) = Player_Data#(N) : NEXT N
temp_player_angle# = WrapValue( temp_player_angle# + MousemoveX() * 0.2 )
Player_Data#(4) = curveangle( temp_player_angle# , Player_Data#(4) , 5.0 )
rem player speed
IF controlkey() = 1 then Player_Data#(5) = 14
IF controlkey() = 0 then Player_Data#(5) = 7
IF upKey() = 1
Player_Data#(1) = newxvalue( Player_Data#(1) , Player_Data#(4) , Player_Data#(5) )
Player_Data#(3) = newzvalue( Player_Data#(3) , Player_Data#(4) , Player_Data#(5) )
Player_Move = 1
endif
IF downKey() = 1
Player_Data#(1) = newxvalue( Player_Data#(1) , Player_Data#(4) , val("-"+str$(Player_Data#(5))) )
Player_Data#(3) = newzvalue( Player_Data#(3) , Player_Data#(4) , val("-"+str$(Player_Data#(5))) )
Player_Move = 1
endif
IF leftKey() = 1
Player_Data#(1) = Newxvalue( Player_Data#(1) , Wrapvalue( Player_Data#(4) - 90 ) , Player_Data#(5) )
Player_Data#(3) = Newzvalue( Player_Data#(3) ,Wrapvalue( Player_Data#(4) - 90 ) , Player_Data#(5) )
Player_Move = 1
endif
IF rightKey() = 1
Player_Data#(1) = Newxvalue( Player_Data#(1) , Wrapvalue( Player_Data#(4) + 90 ) , Player_Data#(5) )
Player_Data#(3) = Newzvalue( Player_Data#(3) ,Wrapvalue( Player_Data#(4) + 90 ) , Player_Data#(5) )
Player_Move = 1
endif
rem player X / Z limit
IF Player_Data#(1) < 0 then Player_Data#(1) = 0
IF Player_Data#(1) > 9999 then Player_Data#(1) = 9999
IF Player_Data#(3) < 0 then Player_Data#(3) = 0
IF Player_Data#(3) > 9999 then Player_Data#(3) = 9999
POSITION OBJECT 99 , Player_Data#(1), Player_Data#(2) + 50, Player_Data#(3)
rem player colision
FOR N = 100 to 100 + ( Number_OF_Objects - 1 )
Object_Size_X# = 50 + Object_Sizes( N - 99 , 1 )
Object_Size_Y# = 50 + Object_Sizes( N - 99 , 2 )
Object_Size_Z# = 50 + Object_Sizes( N - 99 , 3 )
disx# = abs(object position x( 99 ) - object position x( n ) )
disz# = abs(object position z( 99 ) - object position z( n ) )
disY# = abs(object position Y( 99 ) - object position Y( n ) )
rem test if the object distance is less than object size
if disx# < Object_Size_X# and disz# < Object_Size_Z# and disY# < Object_Size_Y#
rem test X
position object 99 , Player_Data#(1) , Player_Data#(2) , Old_Player_Data#(3)
disx# = abs( object position x( N ) - object position x( 99 ) )
disz# = abs( object position z( N ) - object position z( 99 ) )
if disx# < Object_Size_X# and disz# < Object_Size_Z# then Player_Data#(1) = Old_Player_Data#(1)
rem test Z
position object 99 , Old_Player_Data#(1) , Player_Data#(2) , Player_Data#(3)
disx# = abs( object position x( N ) - object position x( 99 ))
disz# = abs( object position z( N ) - object position z( 99 ))
if disx# < Object_Size_X# and disz# < Object_Size_Z# then Player_Data#(3) = Old_Player_Data#(3)
endif
NEXT N
rem handle the ramp
IF Player_Data#(1) => 3200 and Player_Data#(1) <= 3760 and Player_Data#(3) >= 1850 and Player_Data#(3) <= 2150
Player_Data#(2) = ( 3760 - Player_Data#(1) ) * 0.94
endif
rem change the player Y to the ground
IF Player_Data#(1) => 3760 and Player_Data#(1) <= 3900 and Player_Data#(3) >= 1850 and Player_Data#(3) <= 2150 and Player_Data#(2) >= 0 and Player_Data#(2) <= 100
Player_Data#(2) = 0
endif
IF Player_Data#(2) > 451 then Player_Data#(2) = 450
rem shooting code
IF mouseclick() = 1
IF TIMER() >= weapon_Fire_Timer + 1000
weapon_Fire_Timer = TIMER()
Play sound 1
position object 50000 , Player_Data#(1) , Player_Data#(2) + 100 , Player_Data#(3)
YROTATE OBJECT 50000 , Player_Data#(4)
bullet_Life = TIMER()
bullet_End = 0 : bullet_Hit = 0 : bullet_RIC_Time = 0
wall_Skip = 0
shoot_loop:
MOVE OBJECT 50000 , 2
bullet_RIC_Time = bullet_RIC_Time + 1
rem bullet collision with zombies
FOR N = 1 to MAX_Zombies
IF wall_Skip = 0
IF sphere_collision( 50000 , 2000 + N , 50 ) = 1
Zombie_Data#( N , 1 ) = 0
wall_Skip = 1
play sound 3
endif
endif
NEXT N
IF wall_Skip = 0
rem bullet collision with walls
FOR N = 100 to 100 + ( Number_OF_Objects - 1 )
IF bullet_Hit = 0
rem Bullet_mark
x1 = OBJECT POSITION X( 50000 )
y1 = OBJECT POSITION Y( 50000 )
z1 = OBJECT POSITION Z( 50000 )
x2 = OBJECT POSITION X( N )
y2 = OBJECT POSITION Y( N )
z2 = OBJECT POSITION Z( N )
SizeX = Object_Sizes( N-99 , 1 )
SizeY = Object_Sizes( N-99 , 2 )
SizeZ = Object_Sizes( N-99 , 3 )
IF WithinCube( x1 , y1 , z1 , x2 , y2 , z2 , SizeX , SizeY , SizeZ ) = 1
bullet_Hit = 1 : bullet_End = 1 : Bullet_RIC_WAIT = TIMER()
bullet_mark_Num = 49000 + Bullet_mark
show object bullet_mark_Num
POSITION OBJECT bullet_mark_Num , OBJECT POSITION X( 50000 ) , OBJECT POSITION Y( 50000 ) , OBJECT POSITION Z( 50000 )
Bullet_mark = Bullet_mark + 1
IF Bullet_mark > 30 then Bullet_mark = 1
endif
endif
NEXT N
endif
IF TIMER() >= bullet_Life + 200 then bullet_End = 1
IF bullet_End = 0 then goto shoot_loop
endif
endif
IF TImer() >= Bullet_RIC_WAIT + bullet_RIC_Time and bullet_Hit = 1
bullet_Hit = 0
Play sound 2
endif
POSITION OBJECT 99 , Player_Data#(1), Player_Data#(2) + 50, Player_Data#(3)
Fire_line_X# = NEWXVALUE(Player_Data#(1) , Player_Data#(4) , 500 )
Fire_line_Y# = Player_Data#(2) + 100
Fire_line_Z# = NEWZVALUE(Player_Data#(3) , Player_Data#(4) , 500 )
Position object 50002 , Fire_line_X# , Fire_line_Y# , Fire_line_Z#
XROTATE OBJECT 50002 , 90
ZROTATE OBJECT 50002 , wrapvalue( 360 - Player_Data#(4) )
IF Player_Move = 0
show object 1
position object 1 , Player_Data#(1) , Player_Data#(2) , Player_Data#(3)
yrotate object 1 , wrapvalue( Player_Data#(4) + 180 )
Hide OBject 2
else
show object 2
LOOP OBJECT 2
position object 2 , Player_Data#(1) , Player_Data#(2) , Player_Data#(3)
yrotate object 2 , wrapvalue( Player_Data#(4) + 180 )
Hide OBject 1
endif
return
_Make_Level:
Player_Data#(1) = 0 : Player_Data#(2) = 0 : Player_Data#(3) = 0 : Player_Data#(4) = 0
rem small box
MAKE OBJECT CUBE 100 , 100
COLOR OBJECT 100 , RGB(255,255,255)
POSITION OBJECT 100 , 1000, 50, 1000
Object_Sizes( 1 , 1 ) = 50 : Object_Sizes( 1 , 2 ) = 50 : Object_Sizes( 1 , 3 ) = 50
rem X2 as big as the small box
MAKE OBJECT CUBE 101 , 200
COLOR OBJECT 101 , RGB(255,255,255)
POSITION OBJECT 101 , 1000, 100, 2000
Object_Sizes( 2 , 1 ) = 100 : Object_Sizes( 2 , 2 ) = 100 : Object_Sizes( 2 , 3 ) = 100
rem check 1 by 2
MAKE OBJECT CUBE 102 , 200
scale object 102 , 100 , 100 , 200
COLOR OBJECT 102 , RGB(255,255,255)
POSITION OBJECT 102 , 2000, 100, 1000
Object_Sizes( 3 , 1 ) = 100 : Object_Sizes( 3 , 2 ) = 100 : Object_Sizes( 3 , 3 ) = 200
rem check collision with box on an angle
MAKE OBJECT CUBE 103 , 200
scale object 103 , 100 , 100 , 200
COLOR OBJECT 103 , RGB(255,255,255)
POSITION OBJECT 103 , 2000, 100, 2000
Object_Sizes( 4 , 1 ) = 100 : Object_Sizes( 4 , 2 ) = 100 : Object_Sizes( 4 , 3 ) = 200
rem Make the gound
MAKE OBJECT CUBE 104 , 100
scale object 104 , 10000 , 100 , 10000
COLOR OBJECT 104 , RGB(0,128,0)
POSITION OBJECT 104 , 5000 , -50 , 5000
Object_Sizes( 5 , 1 ) = 0 : Object_Sizes( 5 , 2 ) = 0 : Object_Sizes( 5 , 3 ) = 0
rem make ramp / ramp walls
MAKE OBJECT CUBE 105 , 100
scale object 105 , 100 , 800 , 300
ROTATE object 105 , 0 , 0 , 50
COLOR OBJECT 105 , RGB(128,128,128)
POSITION OBJECT 105 , 3500 , 150 , 2000
Object_Sizes( 6 , 1 ) = 0 : Object_Sizes( 6 , 2 ) = 0 : Object_Sizes( 6 , 3 ) = 0
rem wall
MAKE OBJECT CUBE 106 , 100
scale object 106 , 1000 , 500 , 100
COLOR OBJECT 106 , RGB(128,128,128)
POSITION OBJECT 106 , 3400 , 200 , 1800
Object_Sizes( 7 , 1 ) = 500 : Object_Sizes( 7 , 2 ) = 250 : Object_Sizes( 7 , 3 ) = 50
rem wall
MAKE OBJECT CUBE 107 , 100
scale object 107 , 1000 , 500 , 100
COLOR OBJECT 107 , RGB(128,128,128)
POSITION OBJECT 107 , 3400 , 200 , 2200
Object_Sizes( 8 , 1 ) = 500 : Object_Sizes( 8 , 2 ) = 250 : Object_Sizes( 8 , 3 ) = 50
rem floor 1
MAKE OBJECT CUBE 108 , 100
scale object 108 , 500 , 100 , 2000
COLOR OBJECT 108 , RGB(128,128,128)
POSITION OBJECT 108 , 2974 , 400 , 2000
Object_Sizes( 9 , 1 ) = 250 : Object_Sizes( 9 , 2 ) = 50 : Object_Sizes( 9 , 3 ) = 1000
rem wall
MAKE OBJECT CUBE 109 , 100
scale object 109 , 100 , 400 , 300
COLOR OBJECT 109 , RGB(128,128,128)
POSITION OBJECT 109 , 2950 , 175 , 2000
Object_Sizes( 10 , 1 ) = 50 : Object_Sizes( 10 , 2 ) = 200 : Object_Sizes( 10 , 3 ) = 150
MAKE OBJECT CUBE 110 , 100
scale object 110 , 500 , 100 , 2000
COLOR OBJECT 110 , RGB(128,128,128)
POSITION OBJECT 110 , 4000 , 400 , 2000
Object_Sizes( 11 , 1 ) = 250 : Object_Sizes( 11 , 2 ) = 50 : Object_Sizes( 11 , 3 ) = 1000
MAKE OBJECT CUBE 111 , 100
scale object 111 , 700 , 100 , 800
COLOR OBJECT 111 , RGB(128,128,128)
POSITION OBJECT 111 , 3500 , 400 , 1400
Object_Sizes( 12 , 1 ) = 400 : Object_Sizes( 12 , 2 ) = 50 : Object_Sizes( 12 , 3 ) = 400
MAKE OBJECT CUBE 112 , 100
scale object 112 , 700 , 100 , 800
COLOR OBJECT 112 , RGB(128,128,128)
POSITION OBJECT 112 , 3500 , 400 , 2600
Object_Sizes( 13 , 1 ) = 400 : Object_Sizes( 13 , 2 ) = 50 : Object_Sizes( 13 , 3 ) = 400
rem col 1
MAKE OBJECT CUBE 113 , 100
scale object 113 , 100 , 700 , 100
COLOR OBJECT 113 , RGB(128,128,128)
POSITION OBJECT 113 , 2775 , 300 , 1050
Object_Sizes( 14 , 1 ) = 50 : Object_Sizes( 14 , 2 ) = 350 : Object_Sizes( 14 , 3 ) = 50
rem col 2
MAKE OBJECT CUBE 114 , 100
scale object 114 , 100 , 700 , 100
COLOR OBJECT 114 , RGB(128,128,128)
POSITION OBJECT 114 , 4200 , 300 , 1050
Object_Sizes( 15 , 1 ) = 50 : Object_Sizes( 15 , 2 ) = 350 : Object_Sizes( 15 , 3 ) = 50
rem col 3
MAKE OBJECT CUBE 115 , 100
scale object 115 , 100 , 700 , 100
COLOR OBJECT 115 , RGB(128,128,128)
POSITION OBJECT 115 , 2775 , 300 , 2950
Object_Sizes( 16 , 1 ) = 50 : Object_Sizes( 16 , 2 ) = 350 : Object_Sizes( 16 , 3 ) = 50
rem col 4
MAKE OBJECT CUBE 116 , 100
scale object 116 , 100 , 700 , 100
COLOR OBJECT 116 , RGB(128,128,128)
POSITION OBJECT 116 , 4200 , 300 , 2950
Object_Sizes( 17 , 1 ) = 50 : Object_Sizes( 17 , 2 ) = 350 : Object_Sizes( 17 , 3 ) = 50
rem small wall 1
MAKE OBJECT CUBE 117 , 100
scale object 117 , 100 , 100 , 500
COLOR OBJECT 117 , RGB(128,128,128)
POSITION OBJECT 117 , 3800 , 500 , 2000
Object_Sizes( 18 , 1 ) = 50 : Object_Sizes( 18 , 2 ) = 50 : Object_Sizes( 18 , 3 ) = 250
rem small wall 2
MAKE OBJECT CUBE 118 , 100
scale object 118 , 550 , 100 , 100
COLOR OBJECT 118 , RGB(128,128,128)
POSITION OBJECT 118 , 3500 , 500 , 1800
Object_Sizes( 19 , 1 ) = 275 : Object_Sizes( 19 , 2 ) = 50 : Object_Sizes( 19 , 3 ) = 50
rem small wall 3
MAKE OBJECT CUBE 119 , 100
scale object 119 , 550 , 100 , 100
COLOR OBJECT 119 , RGB(128,128,128)
POSITION OBJECT 119 , 3500 , 500 , 2200
Object_Sizes( 20 , 1 ) = 275 : Object_Sizes( 20 , 2 ) = 50 : Object_Sizes( 20 , 3 ) = 50
rem small wall 4
MAKE OBJECT CUBE 120 , 100
scale object 120 , 1450 , 100 , 100
COLOR OBJECT 120 , RGB(128,128,128)
POSITION OBJECT 120 , 3500 , 500 , 1050
Object_Sizes( 21 , 1 ) = 725 : Object_Sizes( 21 , 2 ) = 50 : Object_Sizes( 21 , 3 ) = 50
rem small wall 5
MAKE OBJECT CUBE 121 , 100
scale object 121 , 1450 , 100 , 100
COLOR OBJECT 121 , RGB(128,128,128)
POSITION OBJECT 121 , 3500 , 500 , 2950
Object_Sizes( 22 , 1 ) = 725 : Object_Sizes( 22 , 2 ) = 50 : Object_Sizes( 22 , 3 ) = 50
rem small wall 6
MAKE OBJECT CUBE 122 , 100
scale object 122 , 100 , 100 , 1900
COLOR OBJECT 122 , RGB(128,128,128)
POSITION OBJECT 122 , 2775 , 500 , 2000
Object_Sizes( 23 , 1 ) = 50 : Object_Sizes( 23 , 2 ) = 50 : Object_Sizes( 23 , 3 ) = 950
rem small wall 7
MAKE OBJECT CUBE 123 , 100
scale object 123 , 100 , 100 , 1900
COLOR OBJECT 123 , RGB(128,128,128)
POSITION OBJECT 123 , 4200 , 500 , 2000
Object_Sizes( 24 , 1 ) = 50 : Object_Sizes( 24 , 2 ) = 50 : Object_Sizes( 24 , 3 ) = 950
rem big wall to test the shooting code
MAKE OBJECT CUBE 124 , 100
scale object 124 , 1000 , 300 , 100
COLOR OBJECT 124 , RGB(200,0,200)
POSITION OBJECT 124 , 1000 , 150 , 3500
Object_Sizes( 25 , 1 ) = 500 : Object_Sizes( 25 , 2 ) = 300 : Object_Sizes( 25 , 3 ) = 50
Number_OF_Objects = 25
Make object plain 99 , 100 , 100
ROTATE OBJECT 99, 90, 0, 0
COLOR OBJECT 99 , RGB(255,0,0)
rem make bullet
MAKE OBJECT SPHERE 50000 , 2
COLOR OBJECT 50000 , 0
Hide object 50000
rem make bullets marks
FOR N = 1 to 30
MAKE OBJECT SPHERE 49000 + N , 10
COLOR OBJECT 49000 + N , 0
Hide object 49000 + N
NEXT N
rem fireing line
MAKE OBJECT CYLINDER 50002 , 10
scale object 50002 , 50 , 10000 , 50
color object 50002 , RGB(255,0,0)
return
_Load_Objects:
Load object "models\idle.3ds" , 1
Load object "models\walk.3ds" , 2
FOR N = 1 to MAX_Zombies
Load object "models\walk.3ds" , 2000 + N
rem color object 2000 + N , RGB(255,0,128)
rem LOOP OBJECT 2000 + N
HIDE OBJECT 2000 + N
Make object plain 2100 + N , 100 , 100
rem ROTATE OBJECT 2100 + N , 90, 0, 0
scale object 2100 + N ,100 , 200 , 100
rem TEXTURE OBJECT 2100 + N , 2
SET OBJECT 2100 + N , 1 , 0 , 0
rem COLOR OBJECT 2100 + N , RGB(255,0,0)
rem HIDE OBJECT 2100 + N
NEXT N
return
_load_Bitmaps:
load image "GFX\Matrix tiles.bmp" , 1
rem Load image "GFX\monsters.bmp" , 2
FOR N = 1 to 3
Load image "GFX\" + str$(N) + ".bmp" , 1 + N
NEXT N
return
_settings:
set display mode 640,480,16
SET EMULATION off : sync rate 100 : sync on : hide mouse
cls 0
SET CAMERA RANGE 1 , 5000
FOG ON : FOG COLOR RGB(192,192,192) : FOG DISTANCE 5000
set ambient light 20
BACKDROP ON : color backdrop RGB(192,192,192)
return
_Veribles:
Dim Player_Data#( 5 )
Dim camera_pos#( 3 )
DIM Old_Player_Data#( 5 )
DIM Object_Sizes( 1000 , 3 )
weapon_Fire_Timer = TIMER()
Bullet_mark = 1
MAX_Zombies = 20
DIM Zombie_Data#( MAX_Zombies ,10) : FOR N = 1 to MAX_Zombies : FOR B = 1 to 10 : Zombie_Data#(N,B) = 0 : NEXT B : NEXT N
return
function WithinCube(x1, y1, z1, x2, y2, z2 , SizeX , SizeY , SizeZ )
R_V = 0
min_X = x2 - SizeX : Max_X = x2 + SizeX : min_Y = y2 - SizeY : Max_Y = y2 + SizeY : min_Z = z2 - SizeZ : Max_Z = z2 + SizeZ
IF X1 >= min_X and X1 <= Max_X and Y1 >= min_Y and Y1 <= Max_Y and Z1 >= min_Z and Z1 <= Max_Z then R_V = 1
endfunction R_V
function sphere_collision(nr1,nr2,dist)
x1# = object position x(nr1) : y1# = object position y(nr1) : z1# = object position z(nr1)
x2# = object position x(nr2) : y2# = object position y(nr2) + 100 : z2# = object position z(nr2)
if sqrt( (x1#-x2#)^2 + (y1#-y2#)^2 + (z1#-z2#)^2 ) < dist then exitfunction 1
endfunction 0