You are viewing a single comment's thread from:

RE: Making Wormy Game with Python - Part 1

in Programming & Dev11 months ago

We could optimize the creation of the apple for this:

def generate_apple():
apple_x = random.randint(0, (WIDTH - CELL_SIZE) // CELL_SIZE) * CELL_SIZE
apple_y = random.randint(0, (HEIGHT - CELL_SIZE) // CELL_SIZE) * CELL_SIZE
return apple_x, apple_y