Example #1
0
    def __init__(self,gotoBackController):
        super(BattleFieldController,self).__init__()
        self.lspacer = ImageSprite(images["lspacer"])
        self.lspacer.setpos(0,gamectrlbuttony)
        self.add(self.lspacer)
        self.credits = ImageSprite(images["credits"])
        self.credits.setpos(creditx,credity)
        self.add(self.credits)
        self.paneltop = ImageSprite(images["top"])
        self.paneltop.setpos(topx,self.credits.bottom())
        self.add(self.paneltop)
        self.bttnbkgd = ImageSprite(images["bttnbkgd"])
        self.bttnbkgd.setpos(bttnbkgdx,bttnbkgdy)
        self.add(self.bttnbkgd)
        self.map = None
        self.mousedrag = False
        self.mouseMinimapDown = False

        self.animations = pygame.sprite.Group()
        self.lendcap = SimpleAnimation(\
                images["lendcap"],0,0,28,32,3,1,lendcapx,lendcapy)
        self.lendcap.setIndex(0)
        self.animations.add(self.lendcap)
        self.rendcap = SimpleAnimation(\
                images["rendcap"],0,0,28,32,1,1,rendcapx,rendcapy)
        self.rendcap.setIndex(0)
        self.animations.add(self.rendcap)

        self.buttons = pygame.sprite.Group()
        self.diplobtn = GamePanelButton("diplobtn")
        self.addSprite(self.diplobtn,diplobtnx,diplobtny)
        self.buttons.add(self.diplobtn)

        self.optbtn = GamePanelButton("optbtn")
        self.optbtn.setMouseListener(gotoBackController)
        self.addSprite(self.optbtn,self.diplobtn.right(),diplobtny)
        self.buttons.add(self.optbtn)

        self.radar = SimpleAnimation(\
                images["radar"],0,0,168,110,33,1,radarx,self.paneltop.bottom())
        self.radar.setIndex(0)
        self.animations.add(self.radar)

        self.tabtop = ImageSprite(images["tabtop"])
        self.tabtop.setpos(tabx,self.radar.bottom())
        self.add(self.tabtop)
        self.side0 = ImageSprite(images["sideb"])
        self.side0.setpos(createbtnboxx,self.tabtop.bottom())
        self.add(self.side0)
        self.side1 = ImageSprite(images["sideb"])
        self.side1.setpos(createbtnboxx,self.side0.bottom())
        self.add(self.side1)
        self.side2 = ImageSprite(images["sideb"])
        self.side2.setpos(createbtnboxx,self.side1.bottom())
        self.add(self.side2)
        self.side3 = ImageSprite(images["sideb"])
        self.side3.setpos(createbtnboxx,self.side2.bottom())
        self.add(self.side3)
        self.side4 = ImageSprite(images["sideb"])
        self.side4.setpos(createbtnboxx,self.side3.bottom())
        self.add(self.side4)
        self.side5 = ImageSprite(images["sideb"])
        self.side5.setpos(createbtnboxx,self.side4.bottom())
        self.add(self.side5)
        self.side6 = ImageSprite(images["sideb"])
        self.side6.setpos(createbtnboxx,self.side5.bottom())
        self.add(self.side6)
        self.tabbtm = ImageSprite(images["tabbtm"])
        self.tabbtm.setpos(tabx,self.side6.bottom())
        self.add(self.tabbtm)

        self.repairbtn = GamePanelPressedButton("repairbtn")
        self.addSprite(self.repairbtn,repairbtnx,self.radar.bottom()+7)
        self.buttons.add(self.repairbtn)
        self.sellbtn = GamePanelPressedButton("sellbtn")
        self.addSprite(self.sellbtn,self.repairbtn.right(),self.repairbtn.top())
        self.buttons.add(self.sellbtn)

        self.tab = Set()
        self.tabbtn = []
        for i in range(4):
            self.tabbtn.append(TabButton(i,self.tab,ButtonSet()))
            self.tab.add(self.tabbtn[i])
            self.buttons.add(self.tabbtn[i])
        self.addSprite(self.tabbtn[0],tabbtnx,self.repairbtn.bottom())
        for i in range(1,4):
            self.addSprite(self.tabbtn[i],self.tabbtn[i-1].right(),\
                    self.repairbtn.bottom())
        self.tabbtn[0].under()
Example #2
0
def load_resources(context):

    textures = context.resources['textures'] = {}
    animations = context.resources['animations'] = {}

    def load_texture(key, path, region=None, mipmap=False, wrap=None):
        texture_path = join(RESOURCES_DIR, path)
        texture = Image(texture_path, mipmap=mipmap).texture
        if region:
            texture = texture.get_region(*region)

        textures[key] = texture

    load_texture('grass', 'grass/grass-01.png',
                 (0, 0, BLOCK_SIZE[0], BLOCK_SIZE[1]))
    load_texture('water', 'terrain/water-01.png',
                 (0, 0, BLOCK_SIZE[0], BLOCK_SIZE[1]))
    load_texture('sand', 'terrain/sand-01.png',
                 (0, 0, BLOCK_SIZE[0], BLOCK_SIZE[1]))
    load_texture('rock', 'one-cell-snags/stone-01.png')
    loader_cb(5)
    load_texture('rock2', 'one-cell-snags/stone-02.png')
    load_texture('wood', 'one-cell-snags/log-01.png')
    load_texture('bush', 'one-cell-snags/bush-01.png')
    load_texture('tree', 'tree/tree-01.png')
    loader_cb(10)
    load_texture('rabbit_hero', 'hero/hero-idle-side-01.png')
    load_texture('hare', 'hare/hare-idle-side-01.png')
    load_texture('mountain_horizontal_bottom1',
                 'mountains/mountain-horizontal-bottom-01.png')
    load_texture('mountain_horizontal_bottom2',
                 'mountains/mountain-horizontal-bottom-02.png')
    load_texture('mountain_horizontal_bottom3',
                 'mountains/mountain-horizontal-bottom-03.png')
    load_texture('mountain_horizontal_top1',
                 'mountains/mountain-horizontal-top-01.png')
    loader_cb(20)
    load_texture('mountain_horizontal_top2',
                 'mountains/mountain-horizontal-top-02.png')
    load_texture('mountain_horizontal_top3',
                 'mountains/mountain-horizontal-top-03.png')
    load_texture('mountain_horizontal_left_end_top',
                 'mountains/mountain-horizontal-left-end-top-01.png')
    load_texture('mountain_horizontal_left_end_bottom',
                 'mountains/mountain-horizontal-left-end-bottom-01.png')
    load_texture('mountain_horizontal_right_end_top',
                 'mountains/mountain-horizontal-right-end-top-01.png')
    load_texture('mountain_horizontal_right_end_bottom',
                 'mountains/mountain-horizontal-right-end-bottom-01.png')
    loader_cb(30)
    load_texture('mountain_vertical1', 'mountains/mountain-vertical-01.png')
    load_texture('mountain_vertical2', 'mountains/mountain-vertical-02.png')
    load_texture('mountain_vertical_top_start',
                 'mountains/mountain-vertical-top-start-01.png')
    load_texture('mountain_vertical_top_end',
                 'mountains/mountain-vertical-top-end-01.png')
    load_texture('mountain_vertical_bottom_start',
                 'mountains/mountain-vertical-down-start-01.png')
    load_texture('mountain_vertical_bottom_end',
                 'mountains/mountain-vertical-down-end-01.png')
    loader_cb(40)
    load_texture('mountain_central', 'mountains/mountain-center-center-01.png')
    load_texture('mountain_central_top',
                 'mountains/mountain-center-top-01.png')
    load_texture('holy_carrot', 'holy-carrot/holy-carrot-01.png')
    load_texture('toolbar_bg', 'interface/background.png')
    loader_cb(50)

    ##########################################################################
    # All tree animation
    ##########################################################################

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 5):
        texture = Image(join(RESOURCES_DIR,
                             'tree/tree-blow-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR, 'tree/tree-place-01.png')).texture
    frames.append((texture, frame_time))

    animations['tree_blow'] = SimpleAnimation(frames)

    frames = []
    frame_time = 1.25  # sec
    for i in xrange(1, 5):
        texture = Image(join(RESOURCES_DIR,
                             'tree/tree-grow-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    frames.append((textures['tree'], frame_time))

    animations['tree_grow'] = SimpleAnimation(frames)
    loader_cb(55)

    ##########################################################################
    # Holly carrot animation
    ##########################################################################

    frames = []
    frame_time = 0.25  # sec
    for i in [3, 1, 2]:
        texture = Image(
            join(RESOURCES_DIR,
                 'holy-carrot/holy-carrot-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))

    animations['holy_carrot'] = ReturningAnimation(frames)

    # load water animation
    frames = []
    frame_time = 0.2  # sec
    for i in xrange(1, 6):
        texture = Image(join(RESOURCES_DIR,
                             'terrain/water-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['water'] = SimpleAnimation(frames)

    frame_time = 0.1

    # hero run down animation
    frames = []
    texture = Image(join(RESOURCES_DIR, 'hero/hero-run-down-01.png'),
                    nocache=True).texture
    frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR, 'hero/hero-run-down-01.png')).texture
    texture = flip_horizontal(texture)
    frames.append((texture, frame_time))
    animations['hero_run_down'] = SimpleAnimation(frames)

    frames = []
    texture = Image(join(RESOURCES_DIR, 'hero/hero-run-up-01.png'),
                    nocache=True).texture
    frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR, 'hero/hero-run-up-01.png')).texture
    texture = flip_horizontal(texture)
    frames.append((texture, frame_time))
    animations['hero_run_up'] = SimpleAnimation(frames)

    loader_cb(60)

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hero/hero-idle-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hero_idle'] = SimpleAnimation(frames)

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hero/hero-rotate-top-and-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hero_rotate_top'] = SimpleAnimation(frames)
    animations['hero_rotate_top_r'] = ReverseAnimation(copy(frames))

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hero/hero-rotate-down-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hero_rotate_down'] = SimpleAnimation(frames)
    animations['hero_rotate_down_r'] = ReverseAnimation(copy(frames))

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 10):
        texture = Image(
            join(RESOURCES_DIR,
                 'hero/hero-run-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hero_run'] = SimpleAnimation(frames)

    loader_cb(65)
    ##########################################################################
    # Hero swim animations goes here
    ##########################################################################

    # hero swim run side
    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hero/hero-swim-idle-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hero_swim_idle'] = SimpleAnimation(frames)

    # hero swim run side
    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hero/hero-swim-run-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hero_swim'] = SimpleAnimation(frames)

    # hero swim up-down

    frame_time = 0.1

    # hero swim down
    frames = []
    texture = Image(join(RESOURCES_DIR, 'hero/hero-swim-run-down-01.png'),
                    nocache=True).texture
    frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR,
                         'hero/hero-swim-run-down-01.png')).texture
    texture = flip_horizontal(texture)
    frames.append((texture, frame_time))
    animations['hero_swim_down'] = SimpleAnimation(frames)

    # hero swim down
    frames = []
    texture = Image(join(RESOURCES_DIR, 'hero/hero-swim-run-up-01.png'),
                    nocache=True).texture
    frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR,
                         'hero/hero-swim-run-up-01.png')).texture
    texture = flip_horizontal(texture)
    frames.append((texture, frame_time))
    animations['hero_swim_up'] = SimpleAnimation(frames)

    loader_cb(70)
    # hero swim rotate top

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hero/hero-swim-rotate-top-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hero_swim_rotate_top'] = SimpleAnimation(frames)
    animations['hero_swim_rotate_top_r'] = ReverseAnimation(copy(frames))

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hero/hero-swim-rotate-down-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hero_swim_rotate_down'] = SimpleAnimation(frames)
    animations['hero_swim_rotate_down_r'] = ReverseAnimation(copy(frames))

    loader_cb(75)

    ##########################################################################
    ##########################################################################
    #
    # Load Hare animation here
    #
    ##########################################################################
    ##########################################################################

    frames = []
    frame_time = 0.2  # sec
    for i in xrange(1, 6):
        texture = Image(join(RESOURCES_DIR,
                             'terrain/water-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['water'] = SimpleAnimation(frames)

    frame_time = 0.1

    # hare run down animation
    frames = []
    texture = Image(join(RESOURCES_DIR, 'hare/hare-run-down-01.png'),
                    nocache=True).texture
    frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR, 'hare/hare-run-down-01.png')).texture
    texture = flip_horizontal(texture)
    frames.append((texture, frame_time))
    animations['hare_run_down'] = SimpleAnimation(frames)

    frames = []
    texture = Image(join(RESOURCES_DIR, 'hare/hare-run-up-01.png'),
                    nocache=True).texture
    frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR, 'hare/hare-run-up-01.png')).texture
    texture = flip_horizontal(texture)
    frames.append((texture, frame_time))
    animations['hare_run_up'] = SimpleAnimation(frames)
    loader_cb(80)

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hare/hare-idle-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hare_idle'] = SimpleAnimation(frames)

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hare/hare-rotate-top-and-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hare_rotate_top'] = SimpleAnimation(frames)
    animations['hare_rotate_top_r'] = ReverseAnimation(copy(frames))

    loader_cb(85)

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hare/hare-rotate-down-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hare_rotate_down'] = SimpleAnimation(frames)
    animations['hare_rotate_down_r'] = ReverseAnimation(copy(frames))

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 9):
        texture = Image(
            join(RESOURCES_DIR,
                 'hare/hare-run-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hare_run'] = SimpleAnimation(frames)

    loader_cb(90)
    ##########################################################################
    # Hare swim animations goes here
    ##########################################################################

    # hero swim run side
    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hare/hare-swim-idle-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hare_swim_idle'] = SimpleAnimation(frames)

    # hare swim run side
    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hare/hare-swim-run-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hare_swim'] = SimpleAnimation(frames)

    # hare swim up-down

    frame_time = 0.25

    # hare swim down
    frames = []
    texture = Image(join(RESOURCES_DIR, 'hare/hare-swim-run-down-01.png'),
                    nocache=True).texture
    frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR,
                         'hare/hare-swim-run-down-01.png')).texture
    texture = flip_horizontal(texture)
    frames.append((texture, frame_time))
    animations['hare_swim_down'] = SimpleAnimation(frames)

    # hare swim down
    frames = []
    texture = Image(join(RESOURCES_DIR, 'hare/hare-swim-rotate-02.png'),
                    nocache=True).texture
    frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR,
                         'hare/hare-swim-rotate-02.png')).texture
    texture = flip_horizontal(texture)
    frames.append((texture, frame_time))
    animations['hare_swim_up'] = SimpleAnimation(frames)

    # hare swim rotate top

    loader_cb(95)
    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hare/hare-swim-rotate-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hare_swim_rotate_top'] = SimpleAnimation(frames)
    animations['hare_swim_rotate_top_r'] = ReverseAnimation(copy(frames))

    frames = []
    frame_time = 0.25  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hare/hare-swim-rotate-down-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hare_swim_rotate_down'] = SimpleAnimation(frames)
    animations['hare_swim_rotate_down_r'] = ReverseAnimation(copy(frames))

    frames = []
    frame_time = 0.15  # sec
    for i in xrange(1, 3):
        texture = Image(
            join(RESOURCES_DIR,
                 'hare/hare-rage-run-side-0{}.png'.format(i))).texture
        frames.append((texture, frame_time))
    animations['hare_rage_run'] = SimpleAnimation(frames)

    frames = []
    texture = Image(join(RESOURCES_DIR, 'hare/hare-rage-run-down-01.png'),
                    nocache=True).texture
    frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR,
                         'hare/hare-rage-run-down-01.png')).texture
    texture = flip_horizontal(texture)
    frames.append((texture, frame_time))
    animations['hare_rage_run_down'] = SimpleAnimation(frames)

    frames = []
    texture = Image(join(RESOURCES_DIR, 'hare/hare-rage-run-up-01.png'),
                    nocache=True).texture
    frames.append((texture, frame_time))
    texture = Image(join(RESOURCES_DIR,
                         'hare/hare-rage-run-up-01.png')).texture
    texture = flip_horizontal(texture)
    frames.append((texture, frame_time))
    animations['hare_rage_run_up'] = SimpleAnimation(frames)
    loader_cb(100)
Example #3
0
class BattleFieldController(SpriteContainer):
    def __init__(self,gotoBackController):
        super(BattleFieldController,self).__init__()
        self.lspacer = ImageSprite(images["lspacer"])
        self.lspacer.setpos(0,gamectrlbuttony)
        self.add(self.lspacer)
        self.credits = ImageSprite(images["credits"])
        self.credits.setpos(creditx,credity)
        self.add(self.credits)
        self.paneltop = ImageSprite(images["top"])
        self.paneltop.setpos(topx,self.credits.bottom())
        self.add(self.paneltop)
        self.bttnbkgd = ImageSprite(images["bttnbkgd"])
        self.bttnbkgd.setpos(bttnbkgdx,bttnbkgdy)
        self.add(self.bttnbkgd)
        self.map = None
        self.mousedrag = False
        self.mouseMinimapDown = False

        self.animations = pygame.sprite.Group()
        self.lendcap = SimpleAnimation(\
                images["lendcap"],0,0,28,32,3,1,lendcapx,lendcapy)
        self.lendcap.setIndex(0)
        self.animations.add(self.lendcap)
        self.rendcap = SimpleAnimation(\
                images["rendcap"],0,0,28,32,1,1,rendcapx,rendcapy)
        self.rendcap.setIndex(0)
        self.animations.add(self.rendcap)

        self.buttons = pygame.sprite.Group()
        self.diplobtn = GamePanelButton("diplobtn")
        self.addSprite(self.diplobtn,diplobtnx,diplobtny)
        self.buttons.add(self.diplobtn)

        self.optbtn = GamePanelButton("optbtn")
        self.optbtn.setMouseListener(gotoBackController)
        self.addSprite(self.optbtn,self.diplobtn.right(),diplobtny)
        self.buttons.add(self.optbtn)

        self.radar = SimpleAnimation(\
                images["radar"],0,0,168,110,33,1,radarx,self.paneltop.bottom())
        self.radar.setIndex(0)
        self.animations.add(self.radar)

        self.tabtop = ImageSprite(images["tabtop"])
        self.tabtop.setpos(tabx,self.radar.bottom())
        self.add(self.tabtop)
        self.side0 = ImageSprite(images["sideb"])
        self.side0.setpos(createbtnboxx,self.tabtop.bottom())
        self.add(self.side0)
        self.side1 = ImageSprite(images["sideb"])
        self.side1.setpos(createbtnboxx,self.side0.bottom())
        self.add(self.side1)
        self.side2 = ImageSprite(images["sideb"])
        self.side2.setpos(createbtnboxx,self.side1.bottom())
        self.add(self.side2)
        self.side3 = ImageSprite(images["sideb"])
        self.side3.setpos(createbtnboxx,self.side2.bottom())
        self.add(self.side3)
        self.side4 = ImageSprite(images["sideb"])
        self.side4.setpos(createbtnboxx,self.side3.bottom())
        self.add(self.side4)
        self.side5 = ImageSprite(images["sideb"])
        self.side5.setpos(createbtnboxx,self.side4.bottom())
        self.add(self.side5)
        self.side6 = ImageSprite(images["sideb"])
        self.side6.setpos(createbtnboxx,self.side5.bottom())
        self.add(self.side6)
        self.tabbtm = ImageSprite(images["tabbtm"])
        self.tabbtm.setpos(tabx,self.side6.bottom())
        self.add(self.tabbtm)

        self.repairbtn = GamePanelPressedButton("repairbtn")
        self.addSprite(self.repairbtn,repairbtnx,self.radar.bottom()+7)
        self.buttons.add(self.repairbtn)
        self.sellbtn = GamePanelPressedButton("sellbtn")
        self.addSprite(self.sellbtn,self.repairbtn.right(),self.repairbtn.top())
        self.buttons.add(self.sellbtn)

        self.tab = Set()
        self.tabbtn = []
        for i in range(4):
            self.tabbtn.append(TabButton(i,self.tab,ButtonSet()))
            self.tab.add(self.tabbtn[i])
            self.buttons.add(self.tabbtn[i])
        self.addSprite(self.tabbtn[0],tabbtnx,self.repairbtn.bottom())
        for i in range(1,4):
            self.addSprite(self.tabbtn[i],self.tabbtn[i-1].right(),\
                    self.repairbtn.bottom())
        self.tabbtn[0].under()

    def save(self):
        pass
    
    def get_battle_rect(self):
        return pygame.Rect(0,0,battlewidth,battleheight)

    def goodToPutBuilding(self,name,col,row):
        return self.characters.isEmpty(col,row) and\
            ((self.map.islandGrid(col,row) and canland[name])
          or (self.map.iswaterGrid(col,row) and canwater[name]))
    
    def draw(self,screen):
        super(BattleFieldController,self).draw(screen)

        self.buttons.draw(screen)
        self.animations.draw(screen)
        self.drawMinimap(screen)
        self.drawCreateButtons(screen)

    def drawCreateButtons(self,screen):
        for i in range(4):
            if self.tabbtn[i].children.visible:
                self.drawCreateButtonSet(self.tabbtn[i].children,screen)

    def drawCreateButtonSet(self,buttonSet,screen):
        if not buttonSet.visible: return
        for button in buttonSet:
            ix = button.index % 2
            iy = button.index / 2 + buttonSet.scroll
            button.setpos(ix*createbtnw+createbtnx,iy*createbtnh+self.side0.top())
        buttonSet.group.draw(screen)

    def drawMinimap(self,screen):
        screen.blit(self.minimap,(minimapx,minimapy))
        x,y = self.map.transformMini(-self.map.x,-self.map.y)
        view = pygame.Rect(x,y,self.map.minimapvieww,self.map.minimapviewh)
        pygame.draw.rect(screen,RED,view,1)
    
    def updateMinimapView(self,x,y):
        if x >= minimapx and x <= minimapx + minimapw and\
             y >= minimapy and y <= minimapy + minimaph:
            x,y = self.map.transformFromMini(\
                    x-self.map.minimapvieww/2,y-self.map.minimapviewh/2)
            self.map.x,self.map.y = -x,-y
            self.map.fitOffset()
            self.mouseMinimapDown = True

    def clickButtonSet(self,buttonSet,x,y,button):
        for b in buttonSet:
            if button == 1 or button == 3:
                if not b.disabled and b.contains(x,y):
                    if button == 1:
                        b.mouseListener(b.name)
                    elif button == 3:
                        b.rightMouseListener(b.name)
    
    def onMouseMove(self,x,y,button1=None,button2=None,button3=None):
        super(BattleFieldController,self).onMouseMove(x,y,button1,button2,button3)
        if self.map != None:
            self.map.updateScrollV(x,y,button3==True)
        if self.mouseMinimapDown:
            self.updateMinimapView(x,y)
        
    def onMouseDown(self,x,y,button):
        super(BattleFieldController,self).onMouseDown(x,y,button)
        for i in range(4):
            if self.tabbtn[i].children.visible:
                self.clickButtonSet(self.tabbtn[i].children,x,y,button)
        self.updateMinimapView(x,y)
        
    def onMouseUp(self,x,y,button):
        super(BattleFieldController,self).onMouseUp(x,y,button)
        self.mouseMinimapDown = False
    
    def onKeyDown(self,keyCode,mod):
        if keyCode == pygame.K_LEFT:
            self.map.scrollv[0] = 1
        elif keyCode == pygame.K_RIGHT:
            self.map.scrollv[1] = 1
        elif keyCode == pygame.K_UP:
            self.map.scrollv[2] = 1
        elif keyCode == pygame.K_DOWN:
            self.map.scrollv[3] = 1
        
    def onKeyUp(self,keyCode,mod):
        if keyCode == pygame.K_LEFT:
            self.map.scrollv[0] = 0
        elif keyCode == pygame.K_RIGHT:
            self.map.scrollv[1] = 0
        elif keyCode == pygame.K_UP:
            self.map.scrollv[2] = 0
        elif keyCode == pygame.K_DOWN:
            self.map.scrollv[3] = 0