Exemple #1
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 #2
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')
def load_game_resources():
    """
    Carregamento de recursos para criacao da tela
    final
    """
    global fonts
    fontname = 'stencil'
    fonts.append(txt.Font(fontname, 28))
    snd.preload('select_choose')
Exemple #4
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 #5
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')
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 #7
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 #8
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 #9
0
def load_game_resources():
    """
    Carregamento de recursos para criacao do menu de creditos.
    """
    global fonts, images
    fontname = 'stencil'
    fonts.append((txt.Font(fontname, 20), (255, 255, 0)))
    fonts.append((txt.Font(fontname, 30), (255, 255, 255)))

    font = txt.Font('stencil', 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 #10
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 #11
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 #12
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 #13
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 #14
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')
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)
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 #17
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 #18
0
def load_game_resources():
    fonts.append(txt.Font('sans', 14, italic=1))
    fonts.append(txt.Font('sans', 20, bold=1))
    snd.preload('chimein', 'chimeout')
Exemple #19
0
def load_game_resources():
    snd.preload('gameover', 'startlife', 'levelskip', 'explode')
    snd.preload('boxhot', 'levelfinish', 'shoot', 'whip', 'klank2')
    snd.preload('spring', 'flop')
Exemple #20
0
def load_game_resources():
    global fonts
    fontname = None
    fonts.append(txt.Font(fontname, 28))
    snd.preload('select_choose')