Beispiel #1
0
 def __init__(self, world):
     LayeredDirty.__init__(self)
     
     self.world = world
     self.name = None #the name of the team
     self.suit = None #the pygame.image that shows the team
     self.controlpoint = None #the pygame.image of an controlpoint when this team controls it
     self.brain = None #the AgentBrain class that all agents of this team use to generate actions
     self.spawn_point = (0,0) #the spawning location of this team in the current map
     self.score = 0 #the score of the team in this game
     
     self.stats = collections.defaultdict(float) #saves all the statistics.
Beispiel #2
0
    def __init__(self, sequence:Sequence, offset:tuple, rect:pygame.Rect, skin:Skin):
        LayeredDirty.__init__(self)
        self.sequence = sequence
        self.sequence.addObserver(self)
        self.offset = offset
        self.rect = rect
        self.skin = skin
        self.blocks = []
        self.trackLines = []
        self.barLines = []
        self.lastTime = sequence.getTime()
        self.widthInBeats = sequence.timeSignature.getBeatsForBars(self.Width.DEF_WIDTH_IN_BARS)
        self.activeTrackCount = Sequence.MIN_TRACKS

        self._initializeGridSprites()
Beispiel #3
0
 def __init__(self, *args, **kwargs):
     kwargs.setdefault("_time_threshold", 9e9)
     LayeredDirty.__init__(self, *args, **kwargs)
Beispiel #4
0
    def __init__(self, console=None):
        self.console = console
        self.players = []               # players on the field
        self.objects = []               # objects on the field
        self.deleted = []               # object to delete

        LayeredDirty.__init__(self, _update=True, _time_threshold=1000.0/FPS)
        self.game_over = False
        self.screen = pygame.display.get_surface()

        self.lockfps = FPS
        self.clock = pygame.time.Clock()

        self.bg = load_texture("Misc/backdrop.png")
        self.ice = load_texture("Misc/ice.png", True)
        self.ice_mask = pygame.mask.from_surface(self.ice)
        self.ice_rects = [pygame.Rect(FLIMIT_WIDTH[0], FLIMIT_HEIGHT[0],
                                      FLIMIT_WIDTH[1]-FLIMIT_WIDTH[0],
                                      FLIMIT_HEIGHT[1]-FLIMIT_HEIGHT[0]),
                          self.ice_mask.get_bounding_rects()[0]]
        self.ice_gap_rect = pygame.Rect(270, 0, 66, 175)

        if 'field' in option('debug'):
            debug("FIELD: ice rects: %s"%self.ice_rects)

        self.start = pygame.Surface((640,480))
        self.start.blit(self.bg, (0, 0))
        self.start.blit(self.ice, (0, ICE_YOFFSET))

        self.field = self.start.copy()
        self.ticks = 0                  # total ticks field played

        self.screen.blit(self.field, (0,0))
        # System font, for messages and FPS
        self.sfont = load_font("default.ttf", 14)

        # FPS drawer if needed
        if "fps" in option("show"):
            self.fps = pygame.sprite.GroupSingle()
            self.fps.add(pygame.sprite.DirtySprite())
#            self.fpsprite = pygame.sprite.DirtySprite()
            self.update_fpsprite()
            # show FPS rate on top of everything
            self.add(self.fps, layer=TOP_LAYER)

        # Messages
        self.messages = []
        self.show_messages = []

        self.msgs = pygame.sprite.DirtySprite()
        self.msgs.visible = 0
        self.msgs_offset = 0
        self.msgs_linesize = self.sfont.get_linesize()
        _ssh = self.msgs_linesize * option("max-messages")
        sprite_image(self.msgs, pygame.Surface((640, _ssh)))
        sprite_move(self.msgs, 0, 71)
        self.add(self.msgs, layer=0)

        # Sprite for level's progress
        self.lp_font = load_font('trebuc.ttf', 14)
        self.lp_font.set_bold(True)

        self.level_prgrs = pygame.sprite.DirtySprite()
        sprite_image(self.level_prgrs, pygame.Surface((640, 20)))
        sprite_move(self.level_prgrs, 0, 0)
        self.level_prgrs.image.blit(self.bg, (0,0), self.level_prgrs.rect)
        self.add(self.level_prgrs, layer=TOP_LAYER)
Beispiel #5
0
 def __init__(self, *args, **kwargs):
     kwargs.setdefault("_time_threshold", 9e9)
     LayeredDirty.__init__(self, *args, **kwargs)