I made an improvment on that code:
Graphics3D 640,480,16
Global Gravity# = -0.05 / 1
Global YSpeed# = 0
Collisions 1,2,2,2
Cam=CreateCamera()
Global ball = CreateSphere()
light = CreateLight()
PositionEntity ball,0,30,0
EntityType ball,1
PositionEntity cam,0,10,-25
CameraClsColor cam,0,255,255
ground=CreatePlane()
EntityType ground,2
While Not KeyHit(1)
UpdateGravity()
;TranslateEntity ball,0,-0.1,0
UpdateWorld
If CountCollisions(ball)
ySpeed = 0
EndIf
If EntityCollided(ball,2)
Yspeed = 1.5
TranslateEntity ball,0,Yspeed,0
gravity = Gravity - 0.01 / Yspeed
EndIf
RenderWorld
Flip
Wend
End
Function UpdateGravity()
Yspeed = YSpeed + Gravity
TranslateEntity Ball,0,yspeed,0
End Function
Goober, why don't you look in the Code Archives, they might have something in there.
-me
Graphics3D 640,480,16
Global Gravity# = -0.05 / 1
Global YSpeed# = 0
Collisions 1,2,2,2
Cam=CreateCamera()
Global ball = CreateSphere()
light = CreateLight()
PositionEntity ball,0,30,0
EntityType ball,1
PositionEntity cam,0,10,-25
CameraClsColor cam,0,255,255
ground=CreatePlane()
EntityType ground,2
While Not KeyHit(1)
UpdateGravity()
;TranslateEntity ball,0,-0.1,0
UpdateWorld
If CountCollisions(ball)
ySpeed = 0
EndIf
If EntityCollided(ball,2)
Yspeed = 1.5
TranslateEntity ball,0,Yspeed,0
gravity = Gravity - 0.01 / Yspeed
EndIf
RenderWorld
Flip
Wend
End
Function UpdateGravity()
Yspeed = YSpeed + Gravity
TranslateEntity Ball,0,yspeed,0
End Function
Goober, why don't you look in the Code Archives, they might have something in there.
-me