Argh. Again I'm having problems with my camera, all though this time it DOES follow the Player object. I have posted a pic to show what is happening.
http://www.freewebs.com/lega669/CamMess.bmp
And here is my new code:
rem Make four walls
make object box 1,10,200,1000 : position object 1,-500,100,0 : color object 1,rgb(155,40,20)
make object box 2,10,200,1000 : position object 2, 500,100,0 : color object 2,rgb(155,40,20)
make object box 3,1000,200,10 : position object 3, 0,100,-500 : color object 3,rgb(155,40,20)
make object box 4,1000,200,10 : position object 4, 0,100, 500 : color object 4,rgb(155,40,20)
rem Make a floor and create texture for it
make object box 5,1000,10,1000 : position object 5,0,-5,0 : color object 5,rgb(0,255,0)
create bitmap 1,32,32 : cls rgb(0,155,0) : ink rgb(0,145,0),0 : box 4,4,12,12
get image 1,0,0,32,32 : delete bitmap 1 : texture object 5,1
scale object texture 5,200,200
rem Load texture for the player object.
LOAD BITMAP "alien2.bmp",1
GET IMAGE 1,0,0,512,512
DELETE BITMAP 1
rem Load 3D object and append idle data to it (idle.)
LOAD OBJECT "idle.x",1 : APPEND OBJECT "walk.x",1,100
YROTATE OBJECT 1,170 : FIX OBJECT PIVOT 1
rem Loop 3D object animtaion from 0 to (idle.)
LOOP OBJECT 1,0,100 : SET OBJECT SPEED 1,5
TEXTURE OBJECT 1,1
rem Activate manual syncronization
SYNC ON
rem Begin loop
DO
rem Store old positions
oldposx#=object position x(1)
oldposy#=object position y(1)
oldposz#=object position z(1)
rem Modify character angle based on left/right keys.
stage=0
IF LEFTKEY()=1 THEN a#=a#-8.0
IF RIGHTKEY()=1 THEN a#=a#+8.0
a#=wrapvalue(a#)
rem Modify character position based on up/down keys.
IF UPKEY()=1 THEN x#=NEWXVALUE(x#,a#,0.5) : z#=NEWZVALUE(z#,a#,0.5) : stage=1 : erase=1
IF DOWNKEY()=1 THEN x#=NEWXVALUE(x#,a#,-0.5) : z#=NEWZVALUE(z#,a#,-0.5) :stage=1
rem If character action changes.
IF stage<>oldstage
IF stage=0
SET OBJECT FRAME 1,0.0
LOOP OBJECT 1,0,20
SET OBJECT SPEED 1,5
ENDIF
oldstage=stage
ENDIF
rem Update character position and angle.
POSITION OBJECT 1,x#,0.0,z#
YROTATE OBJECT 1,a#
rem Get current object position
posx#=object position x(1)
posy#=object position y(1)
posz#=object position z(1)
rem Update with new object position
position object 1,posx#,posy#,posz#
rem Use camera tracker to follow player object
angle#=object angle y(1)
camdist#=25.0 : camhigh#=posy#+10.0 : camfade#=3.5
set camera to follow posx#,posy#,posz#,angle#,camdist#,camhigh#,camfade#,1
rem Refresh screen.
SYNC
rem End loop.
LOOP
Unfortunately some of it has to be pushed over and down. I won't quit this thing until I get it right!
"Something wicked this way co- oh, wait, it took a left."