sep-pm-platformer/project/sprite/PositionScale.py

15 lines
517 B
Python

class PositionScale:
def __init__(self, position: tuple[int, int] = (0, 0), scale: tuple[int, int] = (1, 1)):
self.position = position
self.scale = scale
def apply_scale_to_position(self):
return self.position[0] * self.scale[0], self.position[1] * self.scale[1]
@staticmethod
def combine(a, b):
return PositionScale(
(a.position[0] + b.position[0], a.position[1] + b.position[1]),
(a.scale[0] * b.scale[0], a.scale[1] * b.scale[1])
)