def update(): if GameManager.wantChangeScreen: GameManager.createCurrentScreen() GameManager.currentScreen.update() # Dispose managers after updating the game InputManager.dispose() ShaderManager.dispose()
def setMapValues(vbo, ebo, mapValue, tilesPositon, vboCount, eboCount, tileSet): MapRender.mapValues = mapValue MapRender.tilesPosition = tilesPositon MapRender.vbo = vbo MapRender.ebo = ebo MapRender.vboCount = vboCount MapRender.eboCount = eboCount MapRender.currentTileSet = tileSet MapRender.tWidth = len(MapRender.mapValues[0][0]) MapRender.tHeight = len(MapRender.mapValues[0]) width = MapRender.tWidth height = MapRender.tHeight # Set the camera position from game.screen import gamemanager cam = gamemanager.GameManager.cam cam.setPos([0, 0, cam.pos[2]]) cam.setMaximum([width, height]) # Set camera position according to the size of map # In x if width > 18: # Follow the player cam.track[0] = True else: # Don't move cam.track[0] = False cam.addPos([-width / 2, 0, 0]) # In y if height > 12: # Follow the player cam.track[1] = True else: # Don't move cam.track[1] = False cam.addPos([0, -height / 2, 0]) cam.goToEntity() sm.dispose() MapRender.change = [True, True] MapRender.dispose()