当碰到挡板
python
area.direction = Vector2(_ball_dir, randf() * 2 - 1).normalized()
当碰到天花板或者地板
python
area.direction = (area.direction + Vector2(0, _bounce_direction)).normalized()
完整源码: