Posted: 22nd Jan 2009 17:31
Sorry for the dumb questions, I have been up al night but I fugured out a few things. I camera don't flicker and the sphere collision don't jump back and forth. I can now jump on boxes and move across. But there is a new question - the sphere can go through the box when he jumps if it's not totally on top of the box. heres the codesync on
sync rate 0
hide mouse
Make Matrix 1,500,500,50,50
Create Bitmap 1,128,128
CLS RGB(100,2,0)
Get Image 1,0,0,128,128
Set Current Bitmap 0
Delete Bitmap 1
Prepare Matrix Texture 1,1,1,1
Position Matrix 1,0,-5,0
fog on
fog distance 400
make light 1
make camera 1
position camera 1,100,2,100
randomize timer()
I=1
for I=1 to 20
make object cube I,rnd(20)
position object I,rnd(500),get ground height(1,500,500),rnd(500)
color object I,rgb(rnd(255),rnd(255),rnd(255))
set object collision to boxes I
Next
make object sphere 50,10
position object 50,100, 0, 100
set object collision to spheres 50
ypos#=0
do
rem Controlling the Sphere
If Leftkey()=1 Then Yrotate Object 50,Wrapvalue(Object Angle Y(50)-4)
If Rightkey()=1 Then Yrotate Object 50,Wrapvalue(Object Angle Y(50)+4)
if upkey()=1 then move object 50,2
if downkey()=1 then move object 50,-2
if spacekey()=1 then inc ypos#,2
if spacekey()=0 and ypos#>0 and object collision(50,0)=0 then dec ypos#,2
rem Get Spheres Position
xpos#=object position x(50)
rem ypos#=object position y(50)
zpos#=object position z(50)
Rem The sliding collision bit
If Object Collision(50,0)>0 and ypos#=0
Dec XPos#,Get Object Collision X()
rem Dec YPos#,Get Object Collision Y()
Dec ZPos#,Get Object Collision Z()
Endif
Position Object 50,XPos#,YPos#,ZPos#
set camera to follow 1,xpos#,ypos#,zpos#,object angle y(50),60,20,20,0
set cursor 0,0
print "X:",object position x(50)
print "Y:",object position y(50)
print "Z:",object position z(50)
sync
loop