Esempio n. 1
0
def oneTimeInit():
    global fpsDisplay, blockSprites, shipSprite, numbers, background
    global thrust, fire, explode, thrustChannel, effectChannel, generator
    global bulletSplash, tractorSound
    global screen, font, frameCounter
    global blocks, staticScene

    blocks = makegrid(GSX,GSY)
    staticScene = pygame.surface.Surface((640+32,480+64))
    staticScene.set_colorkey((0,0,0))

    frameCounter = 0
    fpsDisplay = pygame.surface.Surface((32,8))
    blockSprites = [None]*32
    blockSprites[0] = loadTransparent("block1.png")
    for (k,v) in blocktypes.iteritems():
        if(v>0):
            blockSprites[v-1] = loadTransparent(k+".png")

    # Conversion of sprites (experimental)
    print "Bit depth of block 1: %d"%blockSprites[0].get_bitsize()


    shipSprite = loadTransparent("ship.png")
    numbers = loadTransparent("8x8numbers.png")
    background = pygame.image.load("background.png")
    mixer.init(channels=2)
    thrust= mixer.Sound("thrust.ogg")
    fire = mixer.Sound("fire.ogg")
    explode = mixer.Sound("explode.ogg")
    generator = mixer.Sound("generator.ogg")
    bulletSplash = mixer.Sound("bulletSplash.wav")
    tractorSound = mixer.Sound("tractor.wav")
    thrustChannel = mixer.Channel(0)
    effectChannel = mixer.Channel(1)
    pygame.init()
    screen = pygame.display.set_mode((640, 480))
    pygame.display.set_caption('Meteor Miner')
    font = pygame.font.Font(pygame.font.get_default_font(),32)
Esempio n. 2
0
import sys
import os

from blocktypes import blocktypes
sprites = []
reverseMap = {}
maxNum = 0
for (k,v) in blocktypes.iteritems():
    reverseMap[v] = k
    print "%d = %s"%(v,k)
    if(v > maxNum): maxNum = v

for i in range(0,maxNum+1):
    try: 
        sprites.append( reverseMap[i]+".png")
    except KeyError:
        print "Unknown number %d"%(i)

cmd = "montage -tile x1 -geometry +0+0 "+" ".join(sprites)+" tiles.png"
print cmd

os.system(cmd)