Words
35
Reading
1 min
Listen
Play
3y
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
RE: Making Wormy Game with Python - Part 1