from visual import *

floor = box (pos=(0,0,0), length=16, height=0.5, width=4, color=color.blue)
ball = sphere (pos=(8,6,0), radius=1, color=color.red)
ball.velocity = vector(-2,-1,0)
dt = 0.01

while 1:
	rate (100)
	ball.pos = ball.pos + ball.velocity*dt
	if ball.y < ball.radius:
		ball.velocity.y = -ball.velocity.y
	elif ball.x < -8 or ball.x > 8:
		ball.x = -ball.x
	else:
		ball.velocity.y = ball.velocity.y - 9.8*dt
		ball.velocity.y = ball.velocity.y * 0.99
		ball.velocity.x = ball.velocity.x * 0.999

