Fixed relative coord update

This commit is contained in:
Marcin Kostrzewski 2020-05-14 11:18:58 +02:00
parent 2bf0ed035b
commit 823eefac86

View File

@ -55,6 +55,8 @@ class Entity(pygame.sprite.Sprite):
def setCoords(self, coords, screenRelative=False): def setCoords(self, coords, screenRelative=False):
if screenRelative: if screenRelative:
self.rect.x, self.rect.y = coords self.rect.x, self.rect.y = coords
self.x = (self.rect.x - self.mapOffset) / self.rect.w
self.y = self.rect.y / self.rect.h
else: else:
self.x, self.y = coords self.x, self.y = coords
self.rect.x = coords[0] * self.rect.w + self.mapOffset self.rect.x = coords[0] * self.rect.w + self.mapOffset