```"""

"""

# ---设置常量

# 屏幕尺寸
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600

# 圆的半径

# 重力常量
GRAVITY_CONSTANT = 0.3

# 减速用的常量
BOUNCINESS = 0.9

def draw(delta_time):
"""
用此函数画所有对象
"""

# 开始渲染，不需要结束渲染

# 画球

# 水平和垂直方向每次增中的值
draw.x += draw.delta_x
draw.y += draw.delta_y

draw.delta_y -= GRAVITY_CONSTANT #  由于受到重力，垂直速度不断减小

# 碰到左右边缘，水平速度不仅取反，还会减小一点
if draw.x < CIRCLE_RADIUS and draw.delta_x < 0:
draw.delta_x *= -BOUNCINESS
elif draw.x > SCREEN_WIDTH - CIRCLE_RADIUS and draw.delta_x > 0:
draw.delta_x *= -BOUNCINESS

# 碰到下边缘
if draw.y < CIRCLE_RADIUS and draw.delta_y < 0:
# If we bounce with a decent velocity, do a normal bounce.
# Otherwise we won't have enough time resolution to accurate represent
# the bounce and it will bounce forever. So we'll divide the bounciness
# by half to let it settle out.
# 让垂直速度小到一定的时候让它不断地减半，这样就不会永远反弹。
if draw.delta_y * -1 > GRAVITY_CONSTANT * 15:
draw.delta_y *= -BOUNCINESS
else:
draw.delta_y *= -BOUNCINESS / 2

draw.delta_x = 2
draw.delta_y = 0

def main():
# 打开一个窗口

# 80分之一秒调用一次draw函数。这个有点像海龟画图模块里屏幕对象的ontimer定时器功能。