def update(self): engine = system.engine p = engine.player p.direction=dir.UP p.state = p.cutsceneWalkState() engine.draw() ika.Video.ShowPage() for i in range(21 * 16 +8): ika.ProcessEntities() p.update() engine.camera.update() engine.draw() ika.Video.ShowPage() ika.Delay(1) p.direction=dir.LEFT p.stop() p.state = p.cutsceneStandState() p.update() y=float(ika.Map.ywin) for i in range(550): if y>100: y-=0.25 ika.Map.ywin=int(y) ika.ProcessEntities() p.update() engine.draw() ika.Video.ShowPage() ika.Delay(1) engine.synchTime() xi.effects.fadeOut(200, draw=system.engine.draw) cabin.scene('epilogue') ending.credits()
def mainloop(): last_update = 0 last_update2 = 0 while 1: if ika.GetTime() > last_update: global last_fps last_update = ika.GetTime() + 10 """ from hawk's code""" if last_fps != ika.GetFrameRate(): ika.SetCaption("Tropfsteinhoehle (FPS: " + str(ika.GetFrameRate()) + ")") last_fps = ika.GetFrameRate() ika.Input.Update() manager.globalupdate() ika.ProcessEntities() if ika.GetTime() > last_update2: ika.Render() manager.globalrender() ika.Video.ShowPage() last_update2 = ika.GetTime() + 1
def tick(self): # We let ika do most of the work concerning entity movement. # (in particular, collision detection) ika.ProcessEntities() # update entities for ent in self.entities: ent.update() self.clearKillQueue() # check fields for f in self.fields: if f.test(self.player): f.fire() break self.updateTime() #captions being displayed are empty and stuff in the queue to fill it! if len(self.captionqueue) > 0 and len(self.captions) == 0: self.captions += self.captionqueue[0] self.captionqueue.pop(0) # update Things. # for each thing in each thing list, we update. # If the result is true, we delete the thing, else # move on. for t in (self.mapThings, self.things, self.captions): i = 0 while i < len(t): result = t[i].update() if result: t.pop(i) else: i += 1
def mainloop(): last_update = 0 last_update2 = 0 while 1: if ika.GetTime() > last_update: global last_fps last_update = ika.GetTime() + 1 # from hawk's code if last_fps != ika.GetFrameRate(): ika.SetCaption("'Duo' (FPS: " + str(ika.GetFrameRate()) + ")") last_fps = ika.GetFrameRate() ika.Input.Update() manager.globalupdate() ika.ProcessEntities() #note: get rid of last_update2 and functionality for better performace (combine with last_update1 or drop if FPS low) if ika.GetTime() >= last_update2: ika.Render() manager.globalrender() ika.Video.ShowPage() last_update2 = ika.GetTime() + 1
def tick(): # We let ika do most of the work concerning entity movement. # (in particular, collision detection) ika.ProcessEntities() if not isCutScene: # update entities for ent in entities: ent.update() # check fields for f in fields: if f.test(player): f.fire() break # Is this the right thing? Maybe all fields under the player should fire. else: # update NPC entities only for ent in entities: if isinstance(ent, Npc): ent.update() clearKillQueue() updateThings()
def PartyMove(movescript): ika.SetPlayer(None) player.Move(movescript) ika.ProcessEntities() while player.IsMoving(): ika.Wait(10) ika.input.Update() ika.SetPlayer(player)
def update(self): p = system.engine.player p.stop() p._state = lambda: None # keep the player from moving p.ent.specframe = 74 #laying in the snow system.engine.camera.update() for i in range(200): ika.Input.Update() ika.ProcessEntities() for t in (system.engine.mapThings): t.update() #hack to keep snow moving system.engine.draw() ika.Video.ShowPage() ika.Delay(1) p.ent.specframe = 73 #gettin up! for i in range(50): ika.Input.Update() ika.ProcessEntities() for t in (system.engine.mapThings): t.update() system.engine.draw() ika.Video.ShowPage() ika.Delay(1) p.ent.specframe = 72 #gettin up! for i in range(50): ika.Input.Update() ika.ProcessEntities() for t in (system.engine.mapThings): t.update() system.engine.draw() ika.Video.ShowPage() ika.Delay(1) p.state = p.standState() system.engine.synchTime() return True
def epilogue(): narration( """And so, finally, he could see the glowing windows and lit fires of his hometown. He had done it. It had taken all of his effort, but he had conquered the trials of that infernal place. """ ) speech(kid1, 'Yay!') speech(kid2, 'I knew he could do it!') speech(kid3, "Yeah, I wasn't worried at all!") speech(kid2, 'Wait a minute...') narration("""With a renewed sense of vigor and purpose, he descended. Finally, he could go home.""") wait(100) sound.step.Play() wait(10) pl.ent.x = 7 * 16 - 8 pl.ent.y = 16 * 16 pl.direction = dir.UP pl.state = pl.cutsceneWalkState() for i in range(56): ika.ProcessEntities() pl.update() draw() ika.Video.ShowPage() wait(1) pl.stop() pl.direction = dir.RIGHT pl._state = lambda: None pl.ent.specframe = 20 ika.ProcessEntities() draw() ika.Video.ShowPage() speech((pl.ent.x, pl.ent.y - 80), "I made it!") speech(kid2, 'Daddy!') speech(grandpa, "Welcome home, son!") speech((pl.ent.x, pl.ent.y - 80), "You wouldn't believe what I had to go through to get back...")
def MainLoop(): last_update = 0 ika.SetCaption("Get the donkey to the end of the road") while 1: #If 1/100th of a second has passed since the last update. if ika.GetTime() > last_update: """ Updates ika's input functions with whatever the player is currently pressing. """ ika.Input.Update() """ Custom Update here. This is where your game's update code goes. """ MyUpdate() ika.ProcessEntities() #Processes the map entities. """ Sets the variable to the current time plus 1 so it knows what to check for the next update. """ last_update = ika.GetTime() + 1 ika.Render() #Draws the map to screen """ Custom Render Here. This is where things your game draws to screen go. """ MyRender() """ This is what actually puts all the new screen updates on the screen. """ ika.Video.ShowPage()