Итак, что вы можете сделать, чтобы найти положение спрайта в Pygame, вы можете использовать get_rect()
, чтобы найти Rect
спрайта, а затем использовать .x
и .y
. Я предполагаю, что вы спрайты pygame.Surface
с.
find_loc(surface):
loc = (surface.get_rect().x, surface.get_rect().y)
return loc
# First, I get the Rect of your surface
# With the Rect, I get the variables of the x and y
# I assign the .get_rect().x and .get_rect().y to a tuple which is assigned to variable 'loc'
# I return 'loc'
Надеюсь, это поможет.