def get_y(self, x):
"""
Calculates the y value (in normal cartesian y-direction (positive values on up axis)) for a given x-value.
:param int x: the x-value (x=0 for left edge of tile x=tilewidth for right edge of tile)
:return: the calculated y-value
:rtype: int
"""
# y = mx + b
if self.slope is None or self.offset is None:
return 0
return self.slope * min(x, self.max_x) + self.offset * self.rect.height
评论列表
文章目录