def enter(self): self.area.loadAll() self.controllers = [] self.ui = LevelUI() vpm = ui.Frame(self.ui, ui.GridPacker()) vp = ui.ViewPort(self.ui, self.area) vpm.addElement(vp) self.ui.addElement(vpm) self.ui.rect = gfx.get_rect() self.camera = vp.camera [ SoundMan.loadSound(c) for c in self.area.getChildren() if isinstance(c, sound.Sound) ] # hackish pub/sub self.area.subscribe(self) self.hero = self.area.getChildByGUID(1) c1 = HeroController(self.hero) c1.program(self.parent.inputs[0]) c1.primestack() self.controllers.append(c1) self.area.space.add_collision_handler(0,1, begin=self.overlap_zone) self.paused = False
def enter(self): self.ui = LevelUI() vpm = ui.Frame(self.ui, ui.GridPacker()) vp = ui.ViewPort(self.ui, self.area) vpm.addElement(vp) self.ui.addElement(vpm) self.ui.rect = gfx.get_rect() self.camera = vp.camera [ SoundMan.loadSound(c) for c in self.area.getChildren() if isinstance(c, sound.Sound) ] # hackish pub/sub self.area.subscribe(self) self.controllers = [] keyboard = KeyboardPlayerInput() self.hero = self.area.getChildByGUID(1) self.hero_body = self.area.getBody(self.hero) # set so player doesn't collide with zones self.area.shapes[self.hero].collision_type = 1 c1 = HeroController(self.hero) c1.program(keyboard) c1.primestack() self.driver.inputs.append(keyboard) self.controllers.append(c1) self.area.space.add_collision_handler(1,2, begin=self.overlap_zone) self.paused = False self.queued_state = None