def onClick(self, pos): clicked = [r for r in self.clicks if r.collidepoint(pos)] log.msg("CLICK! %s" % clicked) if clicked: game = self.games[clicked.pop().topleft] log.msg("CLACK! %s" % game) IWebWorld(333).update({'game': game})
def __init__(self, parser): MultiService.__init__(self) NamedComponentized.__init__(self, parser.parse_args().game) if not self.config.verbose: HTTPClientFactory.noisy = False registerGlobal(self, IClient) self.addService(IWebWorld(self))
def startUp(self): self.games = {} pygame.display.set_caption("Play SimpleTD! ESC or q to quit") self.screen = pygame.display.set_mode((1024,768)) self.background = pygame.image.load('assets/starfield_background-1024x770.png').convert() self.screen.blit(self.background, (0, 0)) self.font = pygame.font.SysFont("monospace", 35) text = self.font.render("SimpleTD!", 1, (255,255,0), (0,0,255)) self.screen.blit(text, (100, 100)) self.world_tiles = None IWebWorld(5).update({'static': 'true'})
def handle(self): c = self.doMoves() if c == ord(' '): engine = IDrawingEngine(self) coords = "%s,%s" % (engine.y, engine.x) IWebWorld(self).update({'place': coords})
def startUp(self): self.world = None IWebWorld(self).update({'static': 'true'})
def handle(self): c = self.doMoves() y = IDrawingEngine(self).y if c == ord(' ') and y - 2 < len(self.games): IWebWorld(self).update({'game': self.games[y - 2]})
def onClick(self, pos): log.msg("You stopped idling!") IWebWorld(333).update({'finish': 'lolo'})
def onClick(self, coord): x, y = coord yg, xg = x/20, y/20 arg = '%d,%d' % (xg-1,yg-1) log.msg("click: %s,%s -> %s" % (x,y,arg)) return IWebWorld(5).update({'place': arg})