Exemple #1
0
def load_game_resources():
    #load ship graphics
    global images
    i = gfx.load('baddie.png')
    i = pygame.transform.flip(i, 0, 1)
    i.set_colorkey((0,0,0))
    imgs = gfx.animstrip(i, 64)
    del imgs[9] #clean animation a little
    images.append(imgs)

    for x in (90, 180, 270):
        rotimgs = []
        for i in imgs:
            r = pygame.transform.rotate(i, x)
            rotimgs.append(r)
        images.append(rotimgs)

    i = gfx.load('baddie-teleport.png')
    i = pygame.transform.flip(i, 0, 1)
    i.set_colorkey((0,0,0))
    imgs = gfx.animstrip(i, 64)
    teleimages.append(imgs)
    for x in (90, 180, 270):
        rotimgs = []
        for i in imgs:
            r = pygame.transform.rotate(i, x)
            rotimgs.append(r)
        teleimages.append(rotimgs)
def load_game_resources():
    #load ship graphics
    global images
    i = gfx.load('baddie.png')
    i = pygame.transform.flip(i, 0, 1)
    i.set_colorkey((0, 0, 0))
    imgs = gfx.animstrip(i, 64)
    del imgs[9]  #clean animation a little
    images.append(imgs)

    for x in (90, 180, 270):
        rotimgs = []
        for i in imgs:
            r = pygame.transform.rotate(i, x)
            rotimgs.append(r)
        images.append(rotimgs)

    i = gfx.load('baddie-teleport.png')
    i = pygame.transform.flip(i, 0, 1)
    i.set_colorkey((0, 0, 0))
    imgs = gfx.animstrip(i, 64)
    teleimages.append(imgs)
    for x in (90, 180, 270):
        rotimgs = []
        for i in imgs:
            r = pygame.transform.rotate(i, x)
            rotimgs.append(r)
        teleimages.append(rotimgs)
Exemple #3
0
 def __init__(self, prevhandler):
     """
     Parametros:
     prevhandler - handler previamente ativo do jogo.
     """
     self.prevhandler = prevhandler
     font = txt.Font(None, 20)
     self.font = txt.Font(None, 22)
     self.rect = Rect(50, 450, 700, 22)
     self.text = font.render('Loading Resources...', 1, (250, 255, 255))
     self.img_powered = gfx.load('pygame_powered.gif')
     self.img_logo = gfx.load('1945.png')
     self.textrect = self.text.get_rect()
     self.textrect.center = self.rect.center
     self.lastcurrent = -1
     snd.play('startup')
     self.top = 120
     self.left = 100
     self.blocks = []
     self.starttime = pygame.time.get_ticks()
     #self.gatherinfo()
     self.handlederror = 0
     self.thread = threading.Thread(None, loadresources)
     game.threadstop = 0
     game.thread = self.thread
     self.thread.start()
Exemple #4
0
 def __init__(self, prevhandler):
     """
     Parametros:
     prevhandler - handler previamente ativo do jogo.
     """
     self.prevhandler = prevhandler
     font = txt.Font(None, 20)
     self.font = txt.Font(None, 22)
     self.rect = Rect(50, 450, 700, 22)
     self.text = font.render('Loading Resources...', 1, (250, 255, 255))
     self.img_powered = gfx.load('pygame_powered.gif')
     self.img_logo = gfx.load('1945.png')
     self.textrect = self.text.get_rect()
     self.textrect.center = self.rect.center
     self.lastcurrent = -1
     snd.play('startup')
     self.top = 120
     self.left = 100
     self.blocks = []
     self.starttime = pygame.time.get_ticks()
     #self.gatherinfo()
     self.handlederror = 0
     self.thread = threading.Thread(None, loadresources)
     game.threadstop = 0
     game.thread = self.thread
     self.thread.start()
Exemple #5
0
def load_game_resources():
    global menu, images, boximages, fame
    images = []
    pos = [20, 380] #[100, 420]
    odd = 0
    for m in menu:
        m.init(pos)
        pos[0] += 150
        odd = (odd+1)%2
        if odd:
            pos[1] += 20
        else:
            pos[1] -= 20
    images.append(gfx.load('menu_on_bgd.png'))
    images[0].set_colorkey(0)
    images.append(gfx.load('logo.png'))
    images.append(gfx.load('ship-big.png'))
    images[1].set_colorkey()
    images[2].set_colorkey()

    global boximages, yboximages, rboximages
    imgs = gfx.load_raw('bigboxes.png')
    origpal = imgs.get_palette()
    boximages = gfx.animstrip(imgs)
    pal = [(g,g,b) for (r,g,b) in origpal]
    imgs.set_palette(pal)
    yboximages = gfx.animstrip(imgs)
    pal = [(g,b,b) for (r,g,b) in origpal]
    imgs.set_palette(pal)
    rboximages = gfx.animstrip(imgs)

    fame = gfx.load('fame.png')

    snd.preload('select_move', 'select_choose')
Exemple #6
0
def load_game_resources():
    global menu, fontimages, boximages, thefont, charset, images, stars
    extraimgs = {'<':gfx.load('rub.gif'), '>':gfx.load('end.gif')}
    for i in extraimgs.values():
        i.set_colorkey(0, RLEACCEL)
    font = txt.Font(None, 100)
    thefont = font
    color = 120, 210, 160
    color2 = 210, 230, 220
    bgd = 0, 0, 0
    xoffset, yoffset = 75, 175
    xsize, ysize = 70, 80
    step = 0
    for letter in charset + '<>':
        pos = xoffset+xsize*(step%10), yoffset+ysize*(step/10)
        if extraimgs.has_key(letter):
            img = img2 = extraimgs[letter]
            r = img.get_rect()
            r.center = pos
        else:
            img, r = font.text(color, letter, pos)
            img2, r2 = font.text(color2, letter, pos)
        fontimages.append((img, r, letter, img2))
        step += 1
        if letter in charset:
            fontlookup[letter] = fontimages[-1]

    xoffset = 40
    for x in range(game.name_maxlength):
        rect = Rect(xoffset+x*xsize, 450, xsize, 100)
        rect2 = Rect(rect.left+1, rect.bottom-15, rect.width-2, 8)
        nameletters.append([rect, rect2, None])

    font = txt.Font(None, 40)
    img = font.render('Enter Your Name:', 1, (220, 210, 180), bgd).convert()
    img.set_colorkey(bgd, RLEACCEL)
    r = img.get_rect()
    r.center = gfx.rect.centerx, 70
    images.append((img, r))

    img = gfx.load('star.gif')
    starsize = img.get_rect()
    tmpstars = []
    for x in range(1, 12*6+2, 12):
        tmp=pygame.transform.rotate(img, x)
        tmpstars.append(tmp)
        starsize.union_ip(tmp.get_rect())
    for s in tmpstars:
        star = pygame.Surface(starsize.size)
        r = s.get_rect()
        r.center = star.get_rect().center
        star.blit(s, r)
        star.set_colorkey(s.get_colorkey(), RLEACCEL)
        stars.append(star)

    snd.preload('select_choose', 'select_move', 'incorrect', 'delete')
Exemple #7
0
def load_game_resources():
    global menu, fontimages, thefont, charset, images, stars
    extraimgs = {'<':gfx.load('rub.gif'), '>':gfx.load('end.gif')}
    for i in extraimgs.values():
        i.set_colorkey(0, pygame.RLEACCEL)
    font = txt.Font(None, 100)
    thefont = font
    color = 120, 210, 160
    color2 = 210, 230, 220
    bgd = 0, 0, 0
    xoffset, yoffset = 75, 175
    xsize, ysize = 70, 80
    step = 0
    for letter in charset + '<>':
        pos = xoffset+xsize*(step%10), yoffset+ysize*(step/10)
        if extraimgs.has_key(letter):
            img = img2 = extraimgs[letter]
            r = img.get_rect()
            r.center = pos
        else:
            img, r = font.text(color, letter, pos)
            img2, r2 = font.text(color2, letter, pos)
        fontimages.append((img, r, letter, img2))
        step += 1
        if letter in charset:
            fontlookup[letter] = fontimages[-1]

    xoffset = 40
    for x in range(game.name_maxlength):
        rect = pygame.Rect(xoffset+x*xsize, 450, xsize, 100)
        rect2 = pygame.Rect(rect.left+1, rect.bottom-15, rect.width-2, 8)
        nameletters.append([rect, rect2, None])

    font = txt.Font(None, 40)
    img = font.render('Enter Your Name:', 1, (220, 210, 180), bgd).convert()
    img.set_colorkey(bgd, pygame.RLEACCEL)
    r = img.get_rect()
    r.center = gfx.rect.centerx, 70
    images.append((img, r))

    img = gfx.load('star.gif')
    starsize = img.get_rect()
    tmpstars = []
    for x in range(1, 12*6+2, 12):
        tmp=pygame.transform.rotate(img, x)
        tmpstars.append(tmp)
        starsize.union_ip(tmp.get_rect())
    for s in tmpstars:
        star = pygame.Surface(starsize.size)
        r = s.get_rect()
        r.center = star.get_rect().center
        star.blit(s, r)
        star.set_colorkey(s.get_colorkey(), pygame.RLEACCEL)
        stars.append(star)

    snd.preload('select_choose', 'select_move', 'incorrect', 'delete')
Exemple #8
0
def load_game_resources():
    """
    Carregamento dos recursos para criacao do mapa.
    """
    global images, blue_background
    blue_background.fill((0, 67, 171))
    
    images.append(gfx.load('island.png', ckey=None))
    images.append(gfx.load('terrain.png', ckey=None))
    images.append(gfx.load('volcano.png', ckey=None))
Exemple #9
0
def load_game_resources():
    global images, namefont, valuefont

    img = pygame.transform.rotate(gfx.load("ship-up.png"), -90)
    images.append((img, img.get_rect()))

    img = gfx.load("menu_setup_on.png")
    images.append((img, img.get_rect().move(20, 20)))

    namefont = txt.Font(None, 42)
    valuefont = txt.Font(None, 36)

    snd.preload("select_choose", "select_move", "delete")
def load_game_resources():
    global images, namefont, valuefont

    img = pygame.transform.rotate(gfx.load('ship-up.png'), -90)
    images.append((img, img.get_rect()))

    img = gfx.load('menu_setup_on.png')
    images.append((img, img.get_rect().move(20, 20)))

    namefont = txt.Font(None, 42)
    valuefont = txt.Font(None, 36)

    snd.preload('select_choose', 'select_move', 'delete')
Exemple #11
0
def load_game_resources():
    """
    Carregamento de recursos para criacao do menu.
    """
    global menu, images, bg_image, select_image
    images = []
    pos = [330, 340]
    #Seta a posicao de cada item do menu na tela
    for m in menu:
        m.init(pos)
        pos[1] += 40

    bg_image = gfx.load('1945.png')
    select_image = gfx.load('select.png')
    snd.preload('select_move', 'select_choose')
Exemple #12
0
def load_game_resources():
    global boximages, yboximages, rboximages, wboximages
    global popimages, spikeimages, wspikeimages
    imgs = gfx.load_raw('boxes.png')
    origpal = imgs.get_palette()
    boximages = gfx.animstrip(imgs)

    pal = [(g, g, b) for (r, g, b) in origpal]
    imgs.set_palette(pal)
    yboximages = gfx.animstrip(imgs)

    pal = [(g, b, b) for (r, g, b) in origpal]
    imgs.set_palette(pal)
    rboximages = gfx.animstrip(imgs)

    pal = [min(g + 60, 255) for (r, g, b) in origpal]
    imgs.set_palette(zip(pal, pal, pal))
    wboximages = gfx.animstrip(imgs)

    popimages = gfx.animstrip(gfx.load('popbox.png'))

    spikes = gfx.load_raw('spikeball.png')
    origpal = spikes.get_palette()
    spikeimages = gfx.animstrip(spikes)
    pal = [(min(r + 100, 255), min(g + 100, 255), min(b + 100, 255))
           for r, g, b in origpal]
    spikes.set_palette(pal)
    wspikeimages = gfx.animstrip(spikes)

    snd.preload('boxhit', 'yboxhit')
Exemple #13
0
def load_game_resources():
    global images
    images = gfx.animstrip(gfx.load('smoke.png'))
    if gfx.surface.get_bytesize() > 1:  #16 or 32bit
        i = 1
        for img in images:
            img.set_alpha((1.8 - math.log(i)) * 40, pygame.RLEACCEL)
            i += 1
Exemple #14
0
 def __init__(self):
     self.imghud1 = gfx.load('hud.gif')
     self.imghud2 = gfx.load('hud2.gif')
     self.timepos = 24, 102
     self.wolfrect = pygame.Rect(16, 57, 37, 19)
     self.timesize = 64, 382
     self.timestep = self.timesize[1] / 1000.0
     self.time = 0
     self.drawsurface = gfx.surface
     self.drawoffset = 800, 0
     self.imglives = pygame.Surface((1, miniship.get_height()))
     self.imglives.set_colorkey(0, pygame.RLEACCEL)
     self.imglevel = score.render(0)
     self.poslives = 10, 510
     self.poslevel = pygame.Rect(15, 550, 1, 1) #changed later in drawlevel
     self.lastlives = 0
     self.lastlevel = 0
Exemple #15
0
 def init(self, pos):
     """
     Inicializa um item do menu em uma dada posicao.
     Parametros:
     pos - posicao do menu na tela principal.
     """
     self.img = gfx.load('menu_'+self.imgname+'.png')
     self.rect = self.img.get_rect().move(pos)
Exemple #16
0
def load_game_resources():
    global images, namefont, textfont, smallfont, delimage

    img = pygame.transform.rotate(gfx.load('ship-up.png'), -90)
    images.append((img, img.get_rect()))

    font = txt.Font(None, 50)
    t = font.text((220, 210, 180), 'Select A Player:', (gfx.rect.centerx, 30))
    images.append(t)

    namefont = txt.Font(None, 46)
    textfont = txt.Font(None, 26)
    smallfont = txt.Font(None, 16)

    snd.preload('select_choose', 'select_move', 'delete')

    delimage = gfx.load('btn-delete.gif')
Exemple #17
0
 def __init__(self):
     self.imghud1 = gfx.load('hud.gif')
     self.imghud2 = gfx.load('hud2.gif')
     self.timepos = 24, 102
     self.wolfrect = pygame.Rect(16, 57, 37, 19)
     self.timesize = 64, 382
     self.timestep = self.timesize[1] / 1000.0
     self.time = 0
     self.drawsurface = gfx.surface
     self.drawoffset = 800, 0
     self.imglives = pygame.Surface((1, miniship.get_height()))
     self.imglives.set_colorkey(0, pygame.RLEACCEL)
     self.imglevel = score.render(0)
     self.poslives = 10, 510
     self.poslevel = pygame.Rect(15, 550, 1, 1)  #changed later in drawlevel
     self.lastlives = 0
     self.lastlevel = 0
Exemple #18
0
def load_game_resources():
    global images
    images = gfx.animstrip(gfx.load('smoke.png'))
    if gfx.surface.get_bytesize()>1: #16 or 32bit
        i = 1
        for img in images:
            img.set_alpha((1.8-math.log(i))*40, pygame.RLEACCEL)
            i += 1
Exemple #19
0
def load_game_resources():
    global images, debris

    img = gfx.load('explosion.png')
    images.extend(gfx.animstrip(img))

    debrisnames = 'base', 'bubble', 'motor'
    debristemp = []
    for d in debrisnames:
        strip = gfx.load('debris-' + d + '.png')
        #strip.insert(0, strip[0])
        debristemp.append(gfx.animstrip(strip))
    #need to to rotations?
    for i in (0,1,1,2,2):
        debris.append(debristemp[i])
    for d in range(1,5):
        strip = gfx.load('debris%d.png'%d)
        debris.append(gfx.animstrip(strip))
Exemple #20
0
def load_game_resources():
    global images, debris

    img = gfx.load('explosion.png')
    images.extend(gfx.animstrip(img))

    debrisnames = 'base', 'bubble', 'motor'
    debristemp = []
    for d in debrisnames:
        strip = gfx.load('debris-' + d + '.png')
        #strip.insert(0, strip[0])
        debristemp.append(gfx.animstrip(strip))
    #need to to rotations?
    for i in (0, 1, 1, 2, 2):
        debris.append(debristemp[i])
    for d in range(1, 5):
        strip = gfx.load('debris%d.png' % d)
        debris.append(gfx.animstrip(strip))
Exemple #21
0
def load_game_resources():
    global images, fonts, downimgs, ship
    img = gfx.load('menu_news_on.png')
    r = img.get_rect().move(10, 10)
    images.append((img, r))

    img = gfx.load('download.png')
    downimgs = gfx.animstrip(img, img.get_width() / 2)
    for i in ('downerror', 'newversion', 'downok'):
        img = gfx.load(i + '.gif')
        downimgs.append(img)

    fonts.append((txt.Font(None, 36, italic=1), (150, 150, 200)))
    fonts.append((txt.Font(None, 22), (120, 120, 250)))
    fonts.append((txt.Font(None, 28), (120, 120, 250)))

    ship = pygame.transform.rotate(gfx.load('ship-up.png'), -90)

    snd.preload('select_choose', 'startlife', 'levelskip')
Exemple #22
0
def load_game_resources():
    global images, fonts, downimgs, ship
    img = gfx.load('menu_news_on.png')
    r = img.get_rect().move(10, 10)
    images.append((img, r))

    img = gfx.load('download.png')
    downimgs = gfx.animstrip(img, img.get_width()/2)
    for i in ('downerror', 'newversion', 'downok'):
        img = gfx.load(i+'.gif')
        downimgs.append(img)

    fonts.append((txt.Font(None, 36, italic=1), (150, 150, 200)))
    fonts.append((txt.Font(None, 22), (120, 120, 250)))
    fonts.append((txt.Font(None, 28), (120, 120, 250)))

    ship = pygame.transform.rotate(gfx.load('ship-up.png'), -90)

    snd.preload('select_choose', 'startlife', 'levelskip')
Exemple #23
0
def load_game_resources():
    global images, origsize
    anim = gfx.animstrip(gfx.load('asteroid.png'))
    origsize = anim[0].get_size()
    for x in range(36):
        set = []
        for img in anim:
            r = pygame.transform.rotate(img, x*10+8)
            set.append(r.convert())
        images.append(set)
Exemple #24
0
def load_game_resources():
    global images, origsize
    anim = gfx.animstrip(gfx.load('asteroid.png'))
    origsize = anim[0].get_size()
    for x in range(36):
        set = []
        for img in anim:
            r = pygame.transform.rotate(img, x * 10 + 8)
            set.append(r.convert())
        images.append(set)
Exemple #25
0
def load_game_resources():
    global images, namefont, namefontheight, textfont, textfontheight, delimage, addimage, allimage
    img = pygame.transform.rotate(gfx.load('ship-up.png'), -90)
    images.append((img, img.get_rect()))

    font = txt.Font(None, 50)
    t = font.text((220, 210, 180), 'Setup Controls', (gfx.rect.centerx, 30))
    images.append(t)
    t = txt.Font('sans', 12).text((180, 220, 180), '(You can Pause the game with the PAUSE or P buttons)', (400, 590))
    images.append(t)

    namefontheight = 46
    namefont = txt.Font(None, 46)
    textfontheight = 26
    textfont = txt.Font(None, textfontheight)

    snd.preload('select_choose', 'select_move', 'incorrect', 'delete')

    delimage = gfx.load('btn-delete.gif')
    addimage = gfx.load('btn-add.gif')
Exemple #26
0
def load_game_resources():
    """
    Carregamento de recursos para criacao do menu de preferencias.
    """
    global images, namefont, valuefont

    img = gfx.load('select.png')
    images.append((img, img.get_rect()))

    namefont = txt.Font('stencil', 26)
    valuefont = txt.Font('stencil', 20)

    snd.preload('select_choose', 'select_move', 'delete')
Exemple #27
0
def load_game_resources():
    global images, namefont, namefontheight, textfont, textfontheight, delimage, addimage, allimage
    img = pygame.transform.rotate(gfx.load('ship-up.png'), -90)
    images.append((img, img.get_rect()))

    font = txt.Font(None, 50)
    t = font.text((220, 210, 180), 'Setup Controls', (gfx.rect.centerx, 30))
    images.append(t)
    t = txt.Font('sans', 12).text(
        (180, 220, 180),
        '(You can Pause the game with the PAUSE or P buttons)', (400, 590))
    images.append(t)

    namefontheight = 46
    namefont = txt.Font(None, 46)
    textfontheight = 26
    textfont = txt.Font(None, textfontheight)

    snd.preload('select_choose', 'select_move', 'incorrect', 'delete')

    delimage = gfx.load('btn-delete.gif')
    addimage = gfx.load('btn-add.gif')
Exemple #28
0
def load_game_resources():
    """
    Carregamento de recursos para criacao do menu de preferencias.
    """
    global images, namefont, valuefont

    img = gfx.load('select.png')
    images.append((img, img.get_rect()))

    namefont = txt.Font('stencil', 26)
    valuefont = txt.Font('stencil', 20)

    snd.preload('select_choose', 'select_move', 'delete')
Exemple #29
0
def load_game_resources():
    global menu, images, fame
    images = []
    pos = [20, 380] #[100, 420]
    odd = 0
    for m in menu:
        m.init(pos)
        pos[0] += 150
        odd = (odd+1)%2
        if odd:
            pos[1] += 20
        else:
            pos[1] -= 20
    images.append(gfx.load('menu_on_bgd.png'))
    images[0].set_colorkey(0)
    images.append(gfx.load('logo.png'))
    images.append(gfx.load('ship-big.png'))
    images[1].set_colorkey()
    images[2].set_colorkey()

    fame = gfx.load('fame.png')

    snd.preload('select_move', 'select_choose')
def load_game_resources():
    global images
    #for i in range(1,16):
    #    img = gfx.load('warp_%04d.gif'%i)
    #    images.append(img)

    images = gfx.animstrip(gfx.load('ship-warp.png'), 48)

    #~ # Hold the blank frame for a few extra counts.
    #~ images[12:] = [images[11]]*2 + [images[-1], images[-2], images[-2], images[-1]]
    #~ # Add on an extra bit of twinkle at the end.
    #~ #images.extend([images[-2],images[-2]])

    images.extend([images[-1]] * 2)
Exemple #31
0
def load_game_resources():
    global images
    #for i in range(1,16):
    #    img = gfx.load('warp_%04d.gif'%i)
    #    images.append(img)

    images = gfx.animstrip(gfx.load('ship-warp.png'), 48)

    #~ # Hold the blank frame for a few extra counts.
    #~ images[12:] = [images[11]]*2 + [images[-1], images[-2], images[-2], images[-1]]
    #~ # Add on an extra bit of twinkle at the end.
    #~ #images.extend([images[-2],images[-2]])

    images.extend([images[-1]]*2)
Exemple #32
0
def load_game_resources():
    global menu, images, fame
    images = []
    pos = [20, 380]  #[100, 420]
    odd = 0
    for m in menu:
        m.init(pos)
        pos[0] += 150
        odd = (odd + 1) % 2
        if odd:
            pos[1] += 20
        else:
            pos[1] -= 20
    images.append(gfx.load('menu_on_bgd.png'))
    images[0].set_colorkey(0)
    images.append(gfx.load('logo.png'))
    images.append(gfx.load('ship-big.png'))
    images[1].set_colorkey()
    images[2].set_colorkey()

    fame = gfx.load('fame.png')

    snd.preload('select_move', 'select_choose')
Exemple #33
0
def load_game_resources():
    """
    Carregamento de recursos para o jogo.
    Imagens de finalizacao e loading, alem de sons,
    sao pre-inicializados aqui.
    """
    global getready_images, statekeys, quit_images, font
    global levelupcolors

    getready_images.append(gfx.load("getready1.png"))
    getready_images.append(gfx.load("getready2.png"))
    quit_images.append(gfx.load("gameover1.png"))
    quit_images.append(gfx.load("gameover2.png"))

    snd.preload("gameover", "startlife", "levelskip", "explode")
    snd.preload("boxhot", "levelfinish", "shoot", "whip", "klank2")
    snd.preload("spring", "flop")

    font = txt.Font("stencil", 16)
    levelupcolors.append((255, 255, 0))
    levelupcolors.append((255, 0, 255))

    statekeys = {}.fromkeys([K_LEFT, K_RIGHT, K_UP, K_DOWN, K_ESCAPE, K_s], False)
Exemple #34
0
def load_game_resources():
    #load ship graphics
    global upimage, shipimages, shieldbg, bulletbg

    upimage = gfx.load('ship-up.png')

    anim = []
    for img in gfx.animstrip(gfx.load('ship-up-boost1.png')):
        imgs = [img]
        for i in range(90, 359, 90):
            imgs.append(pygame.transform.rotate(img, i))
        anim.append(imgs)
    shipimages.extend(zip(*anim))

    anim = []
    for img in gfx.animstrip(gfx.load('ship-up-boost2.png')):
        imgs = [img]
        for i in range(90, 359, 90):
            imgs.append(pygame.transform.rotate(img, i))
        anim.append(imgs)
    shipimages.extend(zip(*anim))

    shieldbg = gfx.animstrip(gfx.load('bonus-shield.png'))
    bulletbg = gfx.animstrip(gfx.load('bonus-bullet.png'))
Exemple #35
0
def load_game_resources():
    #load ship graphics
    global upimage, shipimages, shieldbg, bulletbg

    upimage = gfx.load('ship-up.png')

    anim = []
    for img in gfx.animstrip(gfx.load('ship-up-boost1.png')):
        imgs = [img]
        for i in range(90, 359, 90):
            imgs.append(pygame.transform.rotate(img, i))
        anim.append(imgs)
    shipimages.extend(list(zip(*anim)))

    anim = []
    for img in gfx.animstrip(gfx.load('ship-up-boost2.png')):
        imgs = [img]
        for i in range(90, 359, 90):
            imgs.append(pygame.transform.rotate(img, i))
        anim.append(imgs)
    shipimages.extend(list(zip(*anim)))

    shieldbg = gfx.animstrip(gfx.load('bonus-shield.png'))
    bulletbg = gfx.animstrip(gfx.load('bonus-bullet.png'))
def load_game_resources():
    """
    Carregamento de recursos para o jogo.
    Imagens de finalizacao e loading, alem de sons,
    sao pre-inicializados aqui.
    """
    global getready_images, statekeys, quit_images, font
    global levelupcolors

    getready_images.append(gfx.load('getready1.png'))
    getready_images.append(gfx.load('getready2.png'))
    quit_images.append(gfx.load('gameover1.png'))
    quit_images.append(gfx.load('gameover2.png'))

    snd.preload('gameover', 'startlife', 'levelskip', 'explode')
    snd.preload('boxhot', 'levelfinish', 'shoot', 'whip', 'klank2')
    snd.preload('spring', 'flop')

    font = txt.Font('stencil', 16)
    levelupcolors.append((255, 255, 0))
    levelupcolors.append((255, 0, 255))

    statekeys = {}.fromkeys([K_LEFT, K_RIGHT, K_UP, K_DOWN, K_ESCAPE, K_s],
                            False)
Exemple #37
0
def load_game_resources():
    global fonts, images
    fontname = None
    fonts.append((txt.Font(fontname, 30), (50, 120, 100)))
    fonts.append((txt.Font(fontname, 44), (100, 100, 250)))

    img = gfx.load('oldsolarfox.png')
    r = img.get_rect()
    r.bottomright = gfx.rect.bottomright
    images.append((img, r))

    img = gfx.load('pygame_powered.gif')
    r = img.get_rect().move(540, 20)
    images.append((img, r))

    img = gfx.load('sdlpowered.png')
    r = img.get_rect().move(630, 150)
    images.append((img, r))

    img = gfx.load('pythonpowered.gif')
    r = img.get_rect().move(650, 280)
    images.append((img, r))

    img = gfx.load('menu_creds_on.png')
    r = img.get_rect().move(20, 5)
    images.append((img, r))

    font = txt.Font(None, 15)
    top = 560
    mid = 400
    for l in licenseinfo:
        t = font.text((50, 150, 150), l, (mid, top))
        top += t[1].height
        images.append(t)

    snd.preload('select_choose')
Exemple #38
0
def load_game_resources():
    global rbigboximages, gbigboximages, bbigboximages, wbigboximages
    global rboximages, gboximages, bboximages, wboximages
    global popimages, spikeimages, wspikeimages

    ### Big Boxes ###

    imgs = gfx.load_raw('bigboxes.png')
    imgs.set_colorkey(imgs.get_at((0, 0)))
    origpal = imgs.get_palette()
    gbigboximages = gfx.animstrip(imgs)

    rbigboximages = red_animation(origpal, imgs)
    bbigboximages = blue_animation(origpal, imgs)

    ### Small Boxes ###

    imgs = gfx.load_raw('boxes.png')
    origpal = imgs.get_palette()
    gboximages = gfx.animstrip(imgs)

    rboximages = red_animation(origpal, imgs)
    bboximages = blue_animation(origpal, imgs)
    wboximages = white_animation(origpal, imgs)

    ### Popping box ###

    popimages = gfx.animstrip(gfx.load('popbox.png'))

    ### Spike ###

    spikes = gfx.load_raw('spikeball.png')
    origpal = spikes.get_palette()
    spikeimages = gfx.animstrip(spikes)

    pal = [(min(r + 100, 255), min(g + 100, 255), min(b + 100, 255))
           for r, g, b in origpal]
    spikes.set_palette(pal)
    wspikeimages = gfx.animstrip(spikes)

    ### Sounds ###

    snd.preload('boxhit', 'yboxhit')
Exemple #39
0
def load_game_resources():
    global rbigboximages, gbigboximages, bbigboximages, wbigboximages
    global rboximages, gboximages, bboximages, wboximages
    global popimages, spikeimages, wspikeimages

    ### Big Boxes ###

    imgs = gfx.load_raw('bigboxes.png')
    imgs.set_colorkey(imgs.get_at((0, 0)))
    origpal = imgs.get_palette()
    gbigboximages = gfx.animstrip(imgs)

    rbigboximages = red_animation(origpal, imgs)
    bbigboximages = blue_animation(origpal, imgs)

    ### Small Boxes ###

    imgs = gfx.load_raw('boxes.png')
    origpal = imgs.get_palette()
    gboximages = gfx.animstrip(imgs)

    rboximages = red_animation(origpal, imgs)
    bboximages = blue_animation(origpal, imgs)
    wboximages = white_animation(origpal, imgs)

    ### Popping box ###

    popimages = gfx.animstrip(gfx.load('popbox.png'))

    ### Spike ###

    spikes = gfx.load_raw('spikeball.png')
    origpal = spikes.get_palette()
    spikeimages = gfx.animstrip(spikes)

    pal = [(min(r+100,255),min(g+100,255),min(b+100,255)) for r,g,b in origpal]
    spikes.set_palette(pal)
    wspikeimages = gfx.animstrip(spikes)

    ### Sounds ###

    snd.preload('boxhit', 'yboxhit')
Exemple #40
0
 def load(self, name):
     """
     Carrega o mapa do arquivo.
     
     Parametros:
         name - nome do mapa a ser carregado.
     """
     try:
         f = open(get_resource(name+'.txt'))
     except:
         print 'Could not load map %s.' % name
         raise SystemError
     else:
         for line in f:
             if line[0] == '#': continue
             elif line.strip():
                 tname, tx, ty = line.split(';')
                 img = gfx.load(tname+'.png')
                 tx = int(tx)
                 ty = int(ty) 
                 if tx >= arena.width: tx = arena.width 
                 self.tiles.append(Tile(img, tx, ty))
         f.close()
Exemple #41
0
 def init(self, pos):
     self.img_on = gfx.load('menu_'+self.imgname+'_on.png')
     self.img_off = gfx.load('menu_'+self.imgname+'_off.png')
     self.rect = self.img_on.get_rect().move(pos)
     self.smallrect = self.img_off.get_rect()
     self.smallrect.center = self.rect.center
Exemple #42
0
def load_game_resources():
    global images
    images = gfx.animstrip(gfx.load('popshot.png'), 18)
Exemple #43
0
def load_game_resources():
    global miniship, livesfont
    miniship = gfx.load('ship-mini-boost2.png')
    livesfont = txt.Font(None, 30)
def load_game_resources():
    global corsair_image
    global player_images, greenstalker_images, bluestalker_images, graystalker_images
    global yellowstalker_images, lightgreenstalker_images, war_airplaneimages
    global gunner_images, nogunfighter_images, inv_bluestalker_images, inv_greenstalker_images
    global inv_yellowstalker_images, striker_image, fighter_image

    #load airplanes graphics
    for img in gfx.animstrip(gfx.load('player.png'), width=59, ckey=(0, 0, 0)):
        player_images.append(img)

    for img in gfx.animstrip(gfx.load('war_airplanes.png'),
                             width=93,
                             ckey=(0, 67, 171)):
        war_airplaneimages.append(img)

    for img in gfx.animstrip(gfx.load('greenstalker.png'),
                             width=31,
                             ckey=(0, 67, 171)):
        i = pygame.transform.rotate(img, 90)
        j = pygame.transform.rotate(img, -90)
        greenstalker_images.append(i)
        inv_greenstalker_images.append(j)

    for img in gfx.animstrip(gfx.load('bluestalker.png'),
                             width=31,
                             ckey=(0, 67, 171)):
        i = pygame.transform.rotate(img, 90)
        j = pygame.transform.rotate(img, -90)
        bluestalker_images.append(i)
        inv_bluestalker_images.append(j)

    for img in gfx.animstrip(gfx.load('graystalker.png'),
                             width=31,
                             ckey=(0, 67, 171)):
        img = pygame.transform.rotate(img, 90)
        graystalker_images.append(img)

    for img in gfx.animstrip(gfx.load('yellowstalker.png'),
                             width=31,
                             ckey=(0, 67, 171)):
        i = pygame.transform.rotate(img, 90)
        j = pygame.transform.rotate(img, -90)
        yellowstalker_images.append(i)
        inv_yellowstalker_images.append(j)

    for img in gfx.animstrip(gfx.load('lightgreenstalker.png'),
                             width=31,
                             ckey=(0, 67, 171)):
        img = pygame.transform.rotate(img, 90)
        lightgreenstalker_images.append(img)

    for img in gfx.animstrip(gfx.load('gunner.png'),
                             width=60,
                             ckey=(0, 67, 171)):
        gunner_images.append(img)

    for img in gfx.animstrip(gfx.load('nogunfighter.png'),
                             width=33,
                             ckey=(0, 67, 171)):
        nogunfighter_images.append(img)

    striker_image = gfx.load('striker.png')
    corsair_image = gfx.load('corsair.png')
    fighter_image = gfx.load('fighter.png')
def load_game_resources():
    global images, imagesbaddie

    img = gfx.load('ship-teleport.png')
    images.extend(gfx.animstrip(img))
Exemple #46
0
def load_game_resources():
    global corsair_image
    global player_images, greenstalker_images, bluestalker_images, graystalker_images
    global yellowstalker_images, lightgreenstalker_images, war_airplaneimages
    global gunner_images, nogunfighter_images, inv_bluestalker_images, inv_greenstalker_images
    global inv_yellowstalker_images, striker_image, fighter_image
    
    #load airplanes graphics
    for img in gfx.animstrip(gfx.load('player.png'), width=59, ckey=(0, 0, 0)):
        player_images.append(img)
        
    for img in gfx.animstrip(gfx.load('war_airplanes.png'), width=93, ckey=(0, 67, 171)):
        war_airplaneimages.append(img)
    
    for img in gfx.animstrip(gfx.load('greenstalker.png'), width=31, ckey=(0, 67, 171)):
        i = pygame.transform.rotate(img, 90)
        j = pygame.transform.rotate(img, -90)
        greenstalker_images.append(i)
        inv_greenstalker_images.append(j)
        
    for img in gfx.animstrip(gfx.load('bluestalker.png'), width=31, ckey=(0, 67, 171)):
        i = pygame.transform.rotate(img, 90)
        j = pygame.transform.rotate(img, -90)
        bluestalker_images.append(i)
        inv_bluestalker_images.append(j)

    for img in gfx.animstrip(gfx.load('graystalker.png'), width=31, ckey=(0, 67, 171)):
        img = pygame.transform.rotate(img, 90)
        graystalker_images.append(img)

    for img in gfx.animstrip(gfx.load('yellowstalker.png'), width=31, ckey=(0, 67, 171)):
        i = pygame.transform.rotate(img, 90)
        j = pygame.transform.rotate(img, -90)
        yellowstalker_images.append(i)
        inv_yellowstalker_images.append(j)

    for img in gfx.animstrip(gfx.load('lightgreenstalker.png'), width=31, ckey=(0, 67, 171)):
        img = pygame.transform.rotate(img, 90)
        lightgreenstalker_images.append(img)
    
    for img in gfx.animstrip(gfx.load('gunner.png'), width=60, ckey=(0, 67, 171)):
        gunner_images.append(img)
        
    for img in gfx.animstrip(gfx.load('nogunfighter.png'), width=33, ckey=(0, 67, 171)):
        nogunfighter_images.append(img) 
                      
    striker_image = gfx.load('striker.png')
    corsair_image = gfx.load('corsair.png')
    fighter_image = gfx.load('fighter.png')
def load_game_resources():
    #load shot graphics
    global dict_images
    for name in ('ball', 'double', 'single2'):
        dict_images[name] = [gfx.load(name + '_fire.png')]
Exemple #48
0
def load_game_resources():
    global small_explode_images, big_explode_images
    small_explode_images = gfx.animstrip(gfx.load('explosion_small.png'), width=33)
    big_explode_images = gfx.animstrip(gfx.load('explosion_big.png'), width=66)
Exemple #49
0
def load_game_resources():
    global img_1, img_5, img_10, img_50
    img_1 = gfx.load('score_1.png')
    img_5 = gfx.load('score_5.png')
    img_10 = gfx.load('score_10.png')
    img_50 = gfx.load('score_50.png')
Exemple #50
0
def load_game_resources():
    global images
    images = gfx.animstrip(gfx.load('popshot.png'), 18)
Exemple #51
0
def load_game_resources():
    global images, symbols
    images = gfx.animstrip(gfx.load('powerup.png'))
    symbols = gfx.animstrip(gfx.load('powereffects.png'))
    snd.preload('select_choose')
Exemple #52
0
 def init(self, pos):
     self.img_on = gfx.load('menu_'+self.imgname+'_on.png')
     self.img_off = gfx.load('menu_'+self.imgname+'_off.png')
     self.rect = self.img_on.get_rect().move(pos)
     self.smallrect = self.img_off.get_rect()
     self.smallrect.center = self.rect.center
Exemple #53
0
def load_game_resources():
    global images
    for i in range(1, 6):
        images.append(gfx.load('powerup'+str(i)+'.png'))
    snd.preload('select_choose')
Exemple #54
0
def load_game_resources():
    global images, imagesbaddie

    img = gfx.load('ship-teleport.png')
    images.extend(gfx.animstrip(img))
Exemple #55
0
def load_game_resources():
    global img_1, img_5, img_10, img_50
    img_1 = gfx.load('score_1.png')
    img_5 = gfx.load('score_5.png')
    img_10 = gfx.load('score_10.png')
    img_50 = gfx.load('score_50.png')