RE: RE: Making Wormy Game with Python - Part 1
You are viewing a single comment's thread from:

RE: Making Wormy Game with Python - Part 1

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