@chafari
Alright now the level is fine and all but on level 2 the camera will not follow player 1. Why is this? How can I fix it?
Level 1
rem *************
rem **-Ed GOOF-**
rem *************
rem setup gfx
set display mode 1360,768,32
get image 50,0,0,1360,768,1
sync on : sync rate 120
autocam on
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 make title sequence
repeat
load image "s1.jpg",5
paste image 5,0,0
set text transparent
set text font "Times New Roman"
set text size 100
center text 680,100,"Welcome to Ed Goof Adventure"
set text size 70
center text 680,384,"PRESS ENTER"
set text size 25
center text 680,700,"© 2011 Austin H Wicker"
sync
until returnkey() = 1 or scancode()>0
cls
rem Load Screen 1
SET TEXT TRANSPARENT
paste image 5,0,0
set text size 70
center text 640,100,"Level 1: The Mummy's Tomb"
set text size 25
center text 680,250,"Objectives: Escape King Mummy!!"
center text 680,300,"Ed and his buddies were on the way to visit the DarkBASIC Pyramid"
center text 680,320,"And ran into an unpleasant suprise.."
set text size 25
center text 600,650,"Hint: If King Mummy catches you then good luck!"
set text size 40
center text 1200,700,"LOADING...."
sync
wait 8000
cls
rem make a hud
load image "shot.bmp",3
sprite 1,100,500,3
scale sprite 1,50
rem Play a tune
load music "slayer_dance.mid",1
loop music 1
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,25555,25555,25555
texture object 3,2
position object 3,0,0,20000
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,900
Set object collision to boxes 1
rem Loop 3D object animation from 0 to 20 (idle)
LOOP OBJECT 1,0,20 : SET OBJECT SPEED 1,30
rem Load Mummy (Enemy1)
load image "mummy.dds",7
Load object "h-mummy-move.dbo",9 : Append Object "h-mummy-idle.dbo",9,total object frames(9)
texture object 9,7
scale object 9,90000,90000,90000
yrotate object 9,180 : Fix Object Pivot 9
position object 9,0,0,7000
set object collision to boxes 9
rem Loop Mummy animation from 0 to 20 (idle)
Loop object 9,0,20 : set object speed 9,30
rem set collisions
AUTOMATIC OBJECT COLLISION 2,5,1
AUTOMATIC OBJECT COLLISION 1,5,1
AUTOMATIC CAMERA COLLISION 0,40,1,0
do
rem get mummy to chase ed
point object 9,object position x(1),object position y(1),object position z(1)
move object 9,4.5
rem launch level2
#include "Level2.dba"
rem if the mummy gets ed then you loose
object_hit = OBJECT HIT(1,9)
if object collision(1,0)
paste image 50,0,0
hide sprite 1
goto _jumplabel
endif
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
SET CAMERA TO OBJECT ORIENTATION 1
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 and OBJECT HIT(1,0)=0 THEN x#=NEWXVALUE(x#,a#,6) : z#=NEWZVALUE(z#,a#,6) : stage=1
IF DOWNKEY()=1 and OBJECT HIT(1,0)=0 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#
sync
loop
Level 2
rem setup level 2
_jumplabel:
delete Object 9
delete Object 3
delete Object 2
Delete Object 1
load image "lava1.jpg",10
paste image 10,0,0
set text size 70
center text 640,100,"Level 2: Highway home from Hell"
set text size 25
center text 680,250,"Objectives: Avoid the undead and try and find your way home"
center text 680,300,"Now that Ed s trapped in the underworld"
center text 680,320,"He will need to get home.."
set text size 25
center text 600,650,"Hint: Enemys cant harm you unless they see you.."
set text size 40
center text 1200,700,"PRESS ENTER"
sync
repeat
until scancode()>0
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,900
Set object collision to boxes 1
rem Loop 3D object animation from 0 to 20 (idle)
LOOP OBJECT 1,0,20 : SET OBJECT SPEED 1,30
rem texture backdrop
Load Object "am.dbo",10
scale object 10,5555,5555,5555
rem Setup scene
load image "ground.jpg",20
make matrix 4,10000.0,10000.0,25,25
make matrix 3,10000.0,10000.0,25,25
position matrix 4,-5000,0,5000
prepare matrix texture 4,20,2,2
set matrix texture 4,0,20
position matrix 3,-5000,0,-5000
prepare matrix texture 3,20,2,2
set matrix texture 3,0,20
update matrix 3
update matrix 4
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
SET CAMERA TO OBJECT ORIENTATION 1
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 and OBJECT HIT(1,0)=0 THEN x#=NEWXVALUE(x#,a#,6) : z#=NEWZVALUE(z#,a#,6) : stage=1
IF DOWNKEY()=1 and OBJECT HIT(1,0)=0 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#
sync
loop
Any idea how I can fix this?
Captain Wicker
http://captainwicker.webs.com/