Hi
Im making an FPS game in dbpro.
I use NG to my collisions.
You can walk around and switch between 2 weopens.
Now i made my test map in Cshop 4.01.
I exported it as an x file.
Now when i try to use NG collision in my fps game it won`t work. It still just walking through the walls.
I try to use my 2 weopens as PLAYER objects.
Here is the complete code i use:
Rem Project: Zombie slayer
Rem Created: 28-01-2005 17:38:48
Rem ***** Main Source File *****
` put the autocam off
Autocam off
` Show some text info on the screen
print "This is currently a test engine for Zombie slayer"
print "This game is made by : The Nerd"
wait key
cls
` set ambient light on 100
set ambient light 100
` Sync setup and hide the mouse
sync on
sync rate 30
hide mouse
`start collision system
StartCollisionPRO(000000000,000000000,000000000)
`set collision system to debug mode
StartCollisionDebugPRO()
`set exclusive mode to 0
SetCollisionExclusive( 0 )
`set constants to make program easier to read
#Constant TYPE_NGC_ELLIP=1
#Constant TYPE_NGC_MESH=2
#Constant ELLIP_2_ELLIP=1
#Constant ELLIP_2_POLY=2
#Constant RESP_STICK=1
#Constant RESP_SLIDE=2
#Constant RESP_SLIDE_NO_SLOPES=3
#Constant RESP_SLIDE_NO_GRAV=4
#Constant RESP_SLIDE_NO_ACCEL=5
#Constant RESP_NONE=6
#Constant DYN_NO_RESP=1
#Constant DYN_RESP=2
#Constant DYN_RESP_NOTURN=3
#Constant Auto_Priority=0
#Constant Type_Player=9
#constant type_player=2
#Constant Type_Wall=1
rem set collision types
SetCollisionsPRO(Type_Player, Type_Wall, ELLIP_2_POLY, RESP_SLIDE, DYN_NO_RESP,Auto_Priority )
` make an object plain for the bullet, gun cursor and the gun effect
Make Object Plain 4,1,1
make object plain 5,1,1
make object plain 8,1,1
` Load the media
` load the sounds
load sound "media/sounds/gun.wav", 1
load sound "media/sounds/bug.wav", 2
load sound "media/sounds/reload.wav", 3
` load the texture
load image "media/texture/gun cursor.jpg",1
load image "media/texture/tex.bmp",2
load image "media/texture/gun effect.jpg", 3
` Load the COLT.
load object "media/models/colt.x",9
` load the map and position it
load object "media/map/map.x", 1
position object 1,0,-150,300
` load the enemy and the animation
load object "media/models/enemy/idle.x",6
load object "media/models/enemy/falgetup.x",7
position object 6,0,-130,90
` load the shotgun and position it
load object "media/models/shotgun.x", 2
set object cull 2,0
rotate object 2,0,270,0
position object 2,2,-1,0
hide object 2
color object 2,RGB(255,0,0)
` position the COLT, scale it and hide it
set object cull 9,0
rotate object 9,0,90,0
scale object 9,15,15,15
position object 9,1,-0.90,2
hide object 9
` position the plain in front of the gun and texture it with the gun effect texture
texture object 8,3
position object 8,2,-1,10
hide object 8
` texture the plain with the gun cursor texture
texture object 5,1
scale object 5,8,8,8
` texture the gun
texture object 2,2
` Make the player object
make object box 10,5,5,5
scale object 10,20,20,20
color object 10,RGB(0,255,0)
position object 10,0,-150,300
` The enemy health
enemy = 3
`set the objects to a collision type
CollisionTypePRO( 2,Type_Player)
CollisionTypePRO( 9,Type_Player)
CollisionTypePRO( 1,Type_Wall)
rem set radius for player as it is being used as an ellip collision
SetObjRadiusPRO(1,object size x(2)/2,object size y(2)/2,object size z(2)/2)
` **THIS IS THE START OF THE MAIN LOOP**
do
`update collision system and object positions
RunCollisionPRO()
` This is the AI
position object 7,object position x(6),0, object position z(6)
point object 6,object position z(2),0, object position x(2)
move object 6,4
` This is the collision code
if object collision(4,6)
enemy=enemy-1
hide object 6
stop object 6
stop object 7
play sound 2
play object 7,1
endif
` If the enemy`s health is = 0 then hide the enemy
if enemy<0
hide object 6
hide object 7
endif
` THIS CODE IS THE CODE TO SWITCH BETWEEN THE 2 GUNS
if inkey$() = "d"
play sound 3
hide object 9
show object 2
endif
if inkey$() = "f"
play sound 3
hide object 2
show object 9
endif
` print some infomation on the screen
set cursor 0,0
print "FRAMES PER SECOND : "; screen fps()
print "CONTROLS : "
print " W = move forward"
print " S = move backward"
print " Mouse = look around"
print " D = change to shotgun"
print " F = change to pistol"
` lock the gun effect on
lock object on 8
` Position the gun cursor
position object 5,0,0,10
lock object on 5
` lock the guns to the screen
lock object on 2
lock object on 9
` This is the player control
yang# = wrapvalue( yang# + mousemovex()/2 )
xang# = wrapvalue( xang# + mousemovey()/2 )
if inkey$()= "w" then xpos# = newxvalue( xpos#, yang#, 10 ) : zpos# = newzvalue( zpos#, yang#, 10 )
if inkey$()= "s" then xpos# = newxvalue( xpos#, yang#, -10 ) : zpos# = newzvalue( zpos#, yang#, -10 )
position camera xpos#, ypos#, zpos#
rotate camera xang#, yang#, 0
` **THE CAMERA CONTROL**
`_______________________
rotate camera camera angle x(0)+(mousemovey()/2.0), camera angle y(0)+(mousemovex()/2.0),0
` THIS IS THE BULLET SETTINGS
if mouseclick() = 1
show object 8
endif
if mouseclick() = 0
hide object 8
endif
If MouseClick()=1
Set Object to Camera Orientation 4
Position Object 4,Camera Position X(),Camera Position Y(),Camera Position Z()
Fire = 1
Endif
If Fire = 1
Move Object 4,20
Endif
sync
loop
What is wrong?
Please help.
Thanks
Regards
The Nerd