Arkadaşlar pygame ile parallax scrolling yapmak istiyorum ama camera koduma nasıl uyarlarım bilmiyorum
kamera kodum:
class Camera:
def __init__(self, mapWidth, mapHeight):
self.camera = pg.Rect(0, 0, mapWidth, mapHeight)
self.width = mapWidth
self.height = mapHeight
def apply(self, sprite):
return sprite.rect.move(self.camera.topleft)
def apply_rect(self, rect):
return rect.move(self.camera.topleft)# For The Enemy Health
def update(self, target):
x = -target.rect.centerx + int(WIDTH/2)
y = -target.rect.centery + int(HEIGHT//1.35)
# limit scrolling to map size
x = min(0, x) # left
y = min(0, y) # top
x = max(-(self.width - WIDTH), x) # right
y = max(-(self.height - HEIGHT), y) # bottom
self.camera = pg.Rect(x, y, self.width, self.height)