I already posted this code in the DarkBasic Classic forum, but I thought I could post it here aswell. A little modified, though.
I haven't posted a 20-liner before, but I hope that I'm following all the rules. If I don't, inform me and I'll try to make the better out of it.
Enjoy tha code!
Remstart
Simpel ball physics by Stora_tomtefar 17/4-06. Same physics used in the game Bawnzie, available on the game creator's forum. Enjoy!
Remend
Sync on:Sync rate 60:Set display mode 1024,768,32:Hide mouse:Set camera range 1,300000:Make matrix 1,2000,2000,25,25:Position matrix 1,-1000,-25,-1000:Make object sphere 1,50:Position object 1,0,500,0:H# = 2:FH#=1:Do
If mouseclick()=1 or mouseclick()=3:K#=(mousemoveY()*(-1)):If mouseclick()=1:H#=MousemoveX():Else:H#=0:Yrotate object 1,wrapvalue(object angle Y(1)+mousemoveX()):Endif
Position object 1,object position X(1),object position Y(1)-mousemoveY(),object position Z(1):Move object 1,H#:If object position Y(1)<0 then Position object 1,object position X(1),1,object position Z(1)
Else:Dec K#,0.4:If object position Y(1)<0:Position object 1,object position X(1),object position Y(1)-K#,object position Z(1):K#=(K#*(-1))*0.75:H#=H#*0.75:Endif:Position object 1,object position X(1),object position Y(1)+K#,object position Z(1)
Move object 1,H#:Endif:If spacekey()=1 then inc K#,1:Position camera 1000,0,500:Point camera object position X(1),object position Y(1),object position Z(1)
Set cursor 0,0
Print "Ball position; XYZ"
Print ""+str$(Object position X(1))+", "+str$(Object position Y(1))+", "+str$(Object position Z(1))
Print "Variables:"
Print "Function - Name = Value"
Print "Force - K# = "+str$(K#)
Print "Speed - H# = "+str$(H#)
Print "Framerate:"
Print screen FPS()
Sync
Loop
www.godhatessweden.com
Good laughter!