Okay this is going to be my input---
Here's some fully commented code on how to do what you just said. It has some simple rolling effects too. Picture positive speed as forwards, and negative speed as backwards. It should work in DBC. Also, I didn't add making the ball's speed unchangable in mid-air, but it can easily be added. Just make it so that all of that speed changing stuff only happens whan the ball is on the ground, or when Ball_On_Ground is equal to 1.
rem *************************************************
rem SIXTY SQUARES' SIMPLE MATRIX EXAMPLE THINGY.
rem *************************************************
rem Begin the setup, blah blah blah...
sync on
sync rate 60
autocam off
rem Create an image for our matrix that we will make. This isn't important. You could just as easily use an image of your own like "Grass09.bmp" or something.
Create bitmap 1,10,10
for d = 1 to 1000
ink rgb(0,100+rnd(155),0),0
dot rnd(10),rnd(10)
next d
blur bitmap 1,6
get image 1,0,0,10,10
delete bitmap 1
rem Make the ball
Make object sphere 1,10
rem Make a matrix
Make matrix 1,10000,10000,60,60
rem Texture the matrix with the image we made earlier.
prepare matrix texture 1,1,1,1
rem Make some hills in the matrix.
SET MATRIX HEIGHT 1,5,5,300
SET MATRIX HEIGHT 1,6,5,350
SET MATRIX HEIGHT 1,5,6,300
SET MATRIX HEIGHT 1,6,6,350
rem Update the matrix.
Update MAtrix 1
do
rem *******************************************
rem ALL OF THIS HANDLES THE BALL'S MOVEMENT!!!
rem *******************************************
rem Use the up/down arrow keys to increase/decrease the ball's speed variable.
rem The ball will be moved at this speed later on, right now we're just changing the variable.
if upkey() then Speed#=Speed#+0.2
if downkey() then Speed#=Speed#-0.2
rem Use the left/right arrow keys to turn the ball
if leftkey() then yrotate object 1,wrapvalue( Object angle y(1)-2 )
if rightkey() then yrotate object 1,wrapvalue( Object angle y(1)+2 )
rem Slowly bring the speed back to 0 to create the effect of friction. (Friction makes objects slow down to a speed of 0)
if Speed#>0 then Speed#=Speed#-0.1
if Speed#<0 then Speed#=Speed#+0.1
rem If the speed goes over the ball's maximum speed (5) then make it equal 5.
if Speed#>5 then Speed#=5
rem If the speed of the ball is less than it's minimum speed (-5) then set the balls speed to equal -5.
if Speed#<-5 then Speed#=-5
rem With both of the things above set, the ball can never go past its speed limitations.
rem Now, we can actually move the ball!
move object 1,Speed#
rem Make the ball look like it's rolling. We just add the ball's speed to limb 0's X angle. Limb 0 is the object's main limb-- usually everything is attached to it.
rem It's speed time 5 because this way the ball is rolling at a good speed compared to the ball's. Try changing the 5 to a 1, or a 100! You'll see.
ROTATE LIMB 1,0,WRAPVALUE(Limb angle x(1,0)+Speed#*5),0,0
rem ****************************************
rem ALL OF THIS HANDLES THE BALL'S JUMPING!
rem ****************************************
rem Have the ball's gravity decrease so that when it's added to the ball's Y position it will move down.
BallGravity#=BallGravity#-0.1
rem Also, assume the ball is not on the ground.
Ball_On_Ground=0
rem Update the ball's position.
position object 1,Object position x(1),object position y(1)+BallGravity#,Object position z(1)
rem If it has gone below the height of the ground at its position, then simply set the gravity to 0, the Bal_On_Ground variable to 1, and put the ball on top of the ground.
rem We add the "+5" on the end because that way we can have the ball fully above the matrix instead of half sinking into it.
If object position y(1)<Get Ground Height(1,Object position x(1),Object position z(1))+5
Position object 1,Object position x(1), Get Ground Height(1,Object position x(1),Object position z(1))+5, Object position z(1)
BallGravity#=0.0
Ball_On_Ground=1
endif
rem Now... When we press space we can just set the gravity to 2 (or any other positive number) to make the ball jump.
rem The higher the number the higher the jump. The ball has to be on the ground to jump though. This is where the Ball_On_Ground variable comes in.
if spacekey() and Ball_On_Ground=1 then BallGravity#=2.0
rem ***************************
rem HERE'S OUR CAMERA CODE!
rem ***************************
rem Make the camera follow the ball.
Set Camera To Follow OBJECT POSITION X(1),OBJECT POSITION Y(1),OBJECT POSITION Z(1),OBJECT ANGLE Y(1),25,10,3.5,0
rem Make the camera always look at the ball. This part can be erased and the camera will still work.
POINT CAMERA OBJECT POSITION X(1),OBJECT POSITION Y(1),OBJECT POSITION Z(1)
sync
loop
Here it is again, but with bouncing! Hooray! The ball will boucne vertically on the Y axis now.
rem *********************************************************************
rem SIXTY SQUARES' SIMPLE MATRIX EXAMPLE THINGY. (BALL BOUNCES ON Y AXIS)
rem *********************************************************************
rem Begin the setup, blah blah blah...
sync on
sync rate 60
autocam off
rem Create an image for our matrix that we will make. This isn't important. You could just as easily use an image of your own like "Grass09.bmp" or something.
Create bitmap 1,10,10
for d = 1 to 1000
ink rgb(0,100+rnd(155),0),0
dot rnd(10),rnd(10)
next d
blur bitmap 1,6
get image 1,0,0,10,10
delete bitmap 1
rem Make the ball
Make object sphere 1,10
rem Make a matrix
Make matrix 1,10000,10000,60,60
rem Texture the matrix with the image we made earlier.
prepare matrix texture 1,1,1,1
rem Make some hills in the matrix.
SET MATRIX HEIGHT 1,5,5,300
SET MATRIX HEIGHT 1,6,5,350
SET MATRIX HEIGHT 1,5,6,300
SET MATRIX HEIGHT 1,6,6,350
rem Update the matrix.
Update MAtrix 1
do
rem *******************************************
rem ALL OF THIS HANDLES THE BALL'S MOVEMENT!!!
rem *******************************************
rem Use the up/down arrow keys to increase/decrease the ball's speed variable.
rem The ball will be moved at this speed later on, right now we're just changing the variable.
if upkey() then Speed#=Speed#+0.2
if downkey() then Speed#=Speed#-0.2
rem Use the left/right arrow keys to turn the ball
if leftkey() then yrotate object 1,wrapvalue( Object angle y(1)-2 )
if rightkey() then yrotate object 1,wrapvalue( Object angle y(1)+2 )
rem Slowly bring the speed back to 0 to create the effect of friction. (Friction makes objects slow down to a speed of 0)
if Speed#>0 then Speed#=Speed#-0.1
if Speed#<0 then Speed#=Speed#+0.1
rem If the speed goes over the ball's maximum speed (5) then make it equal 5.
if Speed#>5 then Speed#=5
rem If the speed of the ball is less than it's minimum speed (-5) then set the balls speed to equal -5.
if Speed#<-5 then Speed#=-5
rem With both of the things above set, the ball can never go past its speed limitations.
rem Now, we can actually move the ball!
move object 1,Speed#
rem Make the ball look like it's rolling. We just add the ball's speed to limb 0's X angle. Limb 0 is the object's main limb-- usually everything is attached to it.
rem It's speed time 5 because this way the ball is rolling at a good speed compared to the ball's. Try changing the 5 to a 1, or a 100! You'll see.
ROTATE LIMB 1,0,WRAPVALUE(Limb angle x(1,0)+Speed#*5),0,0
rem ****************************************
rem ALL OF THIS HANDLES THE BALL'S JUMPING!
rem ****************************************
rem Have the ball's gravity decrease so that when it's added to the ball's Y position it will move down.
BallGravity#=BallGravity#-0.1
rem Assume that the ball is not on the ground. If it is, then this will change!
Ball_On_Ground=0
rem Update the ball's position.
position object 1,Object position x(1),object position y(1)+BallGravity#,Object position z(1)
rem If it has gone below the height of the ground at its position, then make the gravity positive (going upwards) and make it 75% of what it was before. This way,
rem when the ball bounces it will only bounce to 75% of its original height. Also make the ball_on_ground variable equal 1, saying that the ball is on the floor.
rem We add the "+5" on the end because that way we can have the ball fully above the matrix instead of half sinking into it.
If object position y(1)<Get Ground Height(1,Object position x(1),Object position z(1))+5
Position object 1,Object position x(1), Get Ground Height(1,Object position x(1),Object position z(1))+5, Object position z(1)
BallGravity#=ABS(BallGravity#)*0.75
Ball_On_Ground=1
endif
rem Now we know that every number can get smaller endlessly without reaching 0, correct? So, let's limit that.
rem If the ball's gravity gets to be really small, then let's just set it to 0.
rem Now... When we press space we can just set the gravity to 2 (or any other positive number) to make the ball jump.
rem The higher the number the higher the jump. The BallGravity# has to equal 0 though, because when it's 0 we know the ball is on the ground.
rem There are other ways of doing this check for the ball being on the ground, but I'm doing it in the same way that they do in the sliding collision example (BASIC 3D EXAMPLE 25)
if spacekey() and Ball_On_Ground=1 then BallGravity#=2.0
If BallGravity#<0.5 and BallGravity#>0 then BallGravity#=0.0
rem ***************************
rem HERE'S OUR CAMERA CODE!
rem ***************************
rem Make the camera follow the ball.
Set Camera To Follow OBJECT POSITION X(1),OBJECT POSITION Y(1),OBJECT POSITION Z(1),OBJECT ANGLE Y(1),25,10,3.5,0
rem Make the camera always look at the ball. This part can be erased and the camera will still work.
POINT CAMERA OBJECT POSITION X(1),OBJECT POSITION Y(1),OBJECT POSITION Z(1)
sync
loop
If you need help with anything in this code, feel free to ask.