diff --git a/gamedata/objects/ingame/player.py b/gamedata/objects/ingame/player.py index 5554616..d9da055 100644 --- a/gamedata/objects/ingame/player.py +++ b/gamedata/objects/ingame/player.py @@ -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: