Returning to overworld takes you to the current level ( instead of the
first )
This commit is contained in:
parent
1751baf2db
commit
48c083d3ff
@ -51,12 +51,15 @@ class Levels(BaseObject):
|
||||
self.names.append(None)
|
||||
|
||||
self.animspeed = 7
|
||||
self.cursor = 0 # Which level is selected
|
||||
self.playerx = self.nodes[0]["x"]
|
||||
self.playery = self.nodes[1]["y"]
|
||||
self.cursor = 0
|
||||
if "levelname" in self.game.globals.keys():
|
||||
self.cursor = self.game.globals["levelname"] # Which level is selected
|
||||
self.playerx = self.nodes[self.cursor]["x"]
|
||||
self.playery = self.nodes[self.cursor]["y"]
|
||||
|
||||
self.tileset = self.game.gameloop.findname("TilesetRenderer")[0]
|
||||
self.maxwidth = self.tileset.layers[0]["surface"].get_width()
|
||||
self.movecamera()
|
||||
|
||||
def step(self):
|
||||
for i in range(len(self.flagsindex)):
|
||||
@ -97,6 +100,9 @@ class Levels(BaseObject):
|
||||
self.playerx += speedx*4*self.game.dt
|
||||
self.playery += speedy*4*self.game.dt
|
||||
|
||||
self.movecamera()
|
||||
|
||||
def movecamera(self):
|
||||
self.game.globals["camerax"] = self.playerx-self.game.globals["cameraw"]/2
|
||||
self.game.globals["camerax"] = max(0,self.game.globals["camerax"])
|
||||
self.game.globals["camerax"] = min(self.maxwidth-self.game.globals["cameraw"],self.game.globals["camerax"])
|
||||
|
Loading…
Reference in New Issue
Block a user