Exemple #1
0
 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})
Exemple #2
0
 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))
Exemple #3
0
    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'})
Exemple #4
0
 def handle(self):
     c = self.doMoves()
     if c == ord(' '):
         engine = IDrawingEngine(self)
         coords = "%s,%s" % (engine.y, engine.x)
         IWebWorld(self).update({'place': coords})
Exemple #5
0
 def startUp(self):
     self.world = None
     IWebWorld(self).update({'static': 'true'})
Exemple #6
0
 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]})
Exemple #7
0
 def onClick(self, pos):
     log.msg("You stopped idling!")
     IWebWorld(333).update({'finish': 'lolo'})
Exemple #8
0
 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})