I cant seem to be able to fix my code to not let objects pass through other objects and the DB tutorial Basic3D 1.5 is all greek to me. I have managed to get the code working somewhat better thanks to darkvee and a few other members but my main goal is to make a completed game featuring 30 levels of fun. If you would take the time to help me out then I would be most pleased with any help you give.
My most updated code is provided below \/
rem *************
rem **-Ed GOOF-**
rem *************
rem setup gfx
set display mode 1366,768,32
sync on : sync rate 120
autocam off
SET GLOBAL COLLISION ON
Backdrop On
make light 1
color light 1,100,100,100
position light 1,0,50,400
set light range 1,500
set camera range 5,500000000000000
rem Play a tune
load music "slayer_dance.mid",1
loop music 1
rem setup hud
Make object Plain 200,1.5,0.5
position object 200,-2.0,4.9,4
Lock object on 200
load image "L1.bmp",200
texture object 200,200
Make object Plain 201,1,1
position object 201,0.0,6.9,6
Lock object on 201
Load image "shot.bmp",201
Texture object 201,201
rem Setup scene
load image "sand1.bmp",1
load object "ml.dbo",2
scale object 2,5555,5555,5555
make matrix 1,10000.0,10000.0,25,25
position matrix 1,-5000,0,-5000
prepare matrix texture 1,1,2,2
set matrix texture 1,0,1
update matrix 1
make matrix 2,10000.0,10000.0,25,25
position matrix 2,-5000,0,5000
prepare matrix texture 2,1,2,2
set matrix texture 2,0,1
update matrix 2
rem Load DB Pyramid
load image "pyramid.tga",2
load object "pyramid.dbo",3
scale object 3,5555,5555,5555
texture object 3,2
position object 3,0,0,9000
rotate object 3,90,180,180
Set object collision to boxes 3
rem Load 3D object and append walking data to it
LOAD OBJECT "idle.dbo",1 : APPEND OBJECT "walk.dbo",1,total object frames(1)
SCALE OBJECT 1,250,250,250
YROTATE OBJECT 1,180 : FIX OBJECT PIVOT 1
position object 1,0,0,500
Set object collision to spheres 1
rem Loop 3D object animation from 0 to 20 (idle)
LOOP OBJECT 1,0,20 : SET OBJECT SPEED 1,30
do
rem Position camera to the back of the character
cx#=newxvalue(x#,wrapvalue(a#+180),300)
cz#=newzvalue(z#,wrapvalue(a#+180),300)
cy#=get ground height(1,cx#,cz#)+100.0
position camera cx#,cy#,cz#
rem Point camera at object
point camera x#,y#,z#
rem move player
stage=0
IF LEFTKEY()=1 THEN a#=a#-2.0
IF RIGHTKEY()=1 THEN a#=a#+2.0
a#=wrapvalue(a#)
rem turn player
IF UPKEY()=1 THEN x#=NEWXVALUE(x#,a#,6) : z#=NEWZVALUE(z#,a#,6) : stage=1
IF DOWNKEY()=1 THEN x#=NEWXVALUE(x#,a#,-6) : z#=NEWZVALUE(z#,a#,-6) : stage=1
rem If character action changes
IF stage<>oldstage
IF stage=0
LOOP OBJECT 1,0,20
SET OBJECT SPEED 1,30
ENDIF
IF stage=1
LOOP OBJECT 1,21,45
SET OBJECT SPEED 1,30
ENDIF
oldstage=stage
ENDIF
rem Update character position and angle
POSITION OBJECT 1,x#,0.0,z#
YROTATE OBJECT 1,a#
Rem Detect collision
If Object collision(1,3)>0 then position object 1,X#,0,Z#
sync
loop
and my project may be downloaded from the bottom right corner of this post >>
Austin H Wicker
http://captainwicker.webs.com/