def create_rain(settings, screen, rains, col_number, row_number): rain = Rain(settings, screen) rain_width = rain.rect.width rain.x = rain_width + 2 * rain_width * col_number rain.rect.x = rain.x # rect存放整数 rain.y = rain.rect.y + 2 * rain.rect.height * row_number rain.rect.y = rain.y rains.add(rain)
def creat_rain(al_setting,screen,rain_number,rain_row,rains): """创建(随机)一个雨滴""" a = randint(0,1) if a: rain = Rain(al_setting,screen) rain.width = rain.rect.width rain.height = rain.rect.height rain.x = rain.width + 2 * rain.width * rain_number rain.rect.x = rain.x rain.y = rain.height + 2 * rain.height * rain_row rain.rect.y = rain.y rains.add(rain)