Blocked the camera

This commit is contained in:
theo@manjaro 2021-11-23 11:50:54 +01:00
parent 1a92f04c6b
commit bec50e6453

View File

@ -22,6 +22,12 @@ class Player(Movable):
self.animationspeed = 2.5
self.canmove = True
self.maxwidth,self.maxheight = self.tileset.layers[0]["surface"].get_size()
if abs(self.maxheight-234)<16:
self.maxheight = self.game.globals["camerah"]
if abs(self.maxwidth-416)<16:
self.maxwidth= self.game.globals["cameraw"]
self.sprite = self.spritestill
collisionratio = 0.7
self.rect[2] = self.sprite.get_width()*collisionratio
@ -251,6 +257,12 @@ class Player(Movable):
self.game.globals["camerax"] = self.rect.center[0]-self.game.globals["cameraw"]/2
self.game.globals["cameray"] = self.rect.center[1]-self.game.globals["camerah"]/2
self.game.globals["camerax"] = max(0,self.game.globals["camerax"])
self.game.globals["cameray"] = max(0,self.game.globals["cameray"])
self.game.globals["camerax"] = min(self.maxwidth-self.game.globals["cameraw"],self.game.globals["camerax"])
self.game.globals["cameray"] = min(self.maxheight-self.game.globals["camerah"],self.game.globals["cameray"])
def upcombo(self):
if self.combotimer<=0: