def eat_food(cell): for f in range(NUM_FOOD): nom = food[f] if cells_collide(cell, nom): new_radius = palgame.get_radius(cell) + (1 - palgame.get_radius(cell) / 100) palgame.set_radius(cell, new_radius) food[f] = palgame.get_random_food()
palgame.build_screen(SCREEN_WIDTH, SCREEN_HEIGHT) x = SCREEN_WIDTH / 2 y = SCREEN_HEIGHT / 2 xdir = 1 ydir = 1 cells = [] food = [] for a in range(NUM_CELLS): cells.append(palgame.get_random_ball()) for c in range(NUM_FOOD): food.append(palgame.get_random_food()) first_cell = palgame.get_random_ball() user_cell = palgame.get_random_user() # This function updates the position of any cell. def update_cell_position(cell, speed): pass # This function updates the position of only the user cell. def update_user_cell_position(cell): pass
palgame.build_screen(SCREEN_WIDTH, SCREEN_HEIGHT) x = SCREEN_WIDTH / 2 y = SCREEN_HEIGHT / 2 xdir = 1 ydir = 1 cells = [] food = [] for a in range(NUM_CELLS): cells.append(palgame.get_random_ball()) for c in range(NUM_FOOD): food.append(palgame.get_random_food()) first_cell = palgame.get_random_ball() user_cell = palgame.get_random_user() # This function updates the position of any cell. def update_cell_position(cell, speed): pass # This function updates the position of only the user cell. def update_user_cell_position(cell): pass # This function returns True if cell1 and cell2 have collided, and False otherwise. def cells_collide(cell1, cell2): pass