Hi guys I'm having a bit of a problem learning my way around DarkBasic Pro.
Displayed is the program which I'm creating, the exact problem I have is whenever the player (a tank) comes close to a mesh I created (to act as a wall) it starts to sink below the level of the mesh and goes under it rather than just stopping dead.
It then stays on the level it sunk down to.
Where should I start looking?
REM *** STREETPLATFORMER LEARNING TUTORIAL ***
REM *** MAIN OBJECTIVE: TO CREATE A 3D PLATFORM STYLE GAME WITH A INTERACTIVE CHARACTER THAT SHOOTS OTHER NON PLAYABLE CHARACTERS ON ONE LEVEL ONLY ***
REM *** 19/10/2013 ALVIN DEWART ***
REM *** DISPLAY MODES ***
SET DISPLAY MODE 1024,768,32
SYNC ON
SYNC RATE 50
HIDE MOUSE
SET CAMERA RANGE 0,100,7500
REM *** LEVEL ***
MAKE OBJECT PLAIN 1,1500,1500
POSITION OBJECT 1,0,0,0
XROTATE OBJECT 1,-90
LOAD IMAGE "OldFloor.bmp",2
TEXTURE OBJECT 1,2
SCALE OBJECT TEXTURE 1,16,16
REM *** SKYSPHERE ***
MAKE OBJECT SPHERE 6,10000
SET OBJECT CULL 6,0
SET OBJECT WIREFRAME 6,0
LOAD IMAGE "SkyBox.bmp",7
TEXTURE OBJECT 6,7
SCALE OBJECT TEXTURE 6,12,12
REM *** PLAYER ***
LOAD OBJECT "Tank.X",2
COLOR OBJECT 2,RGB(0,128,0)
SCALE OBJECT 2,50,50,50
POSITION OBJECT 2,0,25,-500
SET OBJECT COLLISION ON 2
SHOW OBJECT BOUNDS 2,1
XPos#=0: YPos#=0: ZPos#=0
REM YELLOW ENEMY TANK
LOAD OBJECT "Tank.x",3
COLOR OBJECT 3,RGB(128,128,0)
SCALE OBJECT 3,50,50,50
POSITION OBJECT 3,0,25,500
YROTATE OBJECT 3,180
SET OBJECT COLLISION ON 3
SHOW OBJECT BOUNDS 3,1
REM *** WALL COLLISION TEST ***
LOAD OBJECT "Wall.x",4
LOAD IMAGE "CollisionWall.jpg",1
SCALE OBJECT 4,3000,125,500
TEXTURE OBJECT 4,1
SCALE OBJECT TEXTURE 4,1,12
POSITION OBJECT 4,-750,-25,-300
XROTATE OBJECT 4,-90
YROTATE OBJECT 4,90
SET OBJECT COLLISION ON 4
SHOW OBJECT BOUNDS 4,1
DO
REM *** CAMERA CONTROLS ***
If Upkey()=1 Then Move Object 2,5
If Downkey()=1 Then Move Object 2,-5
If Leftkey()=1 Then TURN OBJECT LEFT 2,5
If Rightkey()=1 Then TURN OBJECT RIGHT 2,5
YROTATE OBJECT 6, OBJECT ANGLE Y(6) + 0.025
REM *** CAMERA FOLLOWING MOVEMENT ***
XPos#=Object Position X(2)
YPos#=Object Position Y(2)
ZPos#=Object Position Z(2)
Rem The collision bit
IF OBJECT COLLISION(2,4) > 0
Dec XPos#,Get Object Collision X()
Dec YPos#,Get Object Collision Y()
Dec ZPos#,Get Object Collision Z()
ENDIF
POSITION OBJECT 2,XPos#,YPos#,ZPos#
IF OBJECT COLLISION(2,3) > 0
Dec XPos#,Get Object Collision X()
Dec YPos#,Get Object Collision Y()
Dec ZPos#,Get Object Collision Z()
endif
Position Object 2,XPos#,YPos#,ZPos#
REM CAMERA TO FOLLOW PLAYER
SET CAMERA TO FOLLOW XPos#, YPos#, ZPos#, 45 , 300, 150, 25, 0
SYNC
LOOP
WAIT KEY
END
http://dai.moddb.com