def notify(self, event): if events.isUserEvent(event, "Tick"): self.image, self.rect = self.render_debug(event.userData) self.rect.move_ip(self.location) if events.isUserEvent(event, "FlipDebugDisplay"): if self.alive(): self.kill() else: self.evManager.Post(events.AddToForeground(self))
def notify(self, event): if events.isUserEvent(event, "RequestViewChangeTarget"): print "Got change event" self.change_target(event.userData) elif events.isUserEvent(event, "Tick"): self.redraw() elif events.isUserEvent(event, "AddToBackground"): self.allSprites.add(event.userData, layer=0) elif events.isUserEvent(event, "AddToForeground"): self.allSprites.add(event.userData, layer=1)
def notify(self, event): if events.isUserEvent(event, "PlayerCreated"): player = event.userData if player.name == "Player1": self.foregroundSprites.add(player.entity) if player.name == "CPU": self.backgroundSprites.add(player.entity) elif events.isUserEvent(event, "Tick"): self.redraw() elif events.isUserEvent(event, "AddToBackground"): self.backgroundSprites.add(event.userData) elif events.isUserEvent(event, "AddToForeground"): self.foregroundSprites.add(event.userData)