예제 #1
0
    def load(self):
        pauseImage = sdl.image.load("graphics/states/options.png")
        cursor = sdl.image.load("graphics/sprites/chef_idle_stroke.png")
        blueImage = sdl.image.load("graphics/states/options_indicator.png")

        global optionsTexture
        optionsTexture = driver.renderer.createTextureFromSurface(pauseImage)
        sdl.freeSurface(pauseImage)

        global cursorTexture
        cursorTexture = driver.renderer.createTextureFromSurface(cursor)
        sdl.freeSurface(cursor)

        global indTexture
        indTexture = driver.renderer.createTextureFromSurface(blueImage)
        sdl.free(blueImage)

        global scrollSound, selectSound
        sdl.mixer.allocateChannels(2)
        scrollSound = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile("music//chunks/menu_scroll.wav", 'rw'), 0)
        selectSound = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile("music//chunks/menu_select.wav", 'rw'), 0)

        global boxes
        boxes = []
        boxes.append(MouseBox(225, 190, 260, 115, 'levelZero', 0))
        boxes.append(MouseBox(225, 305, 305, 115, 'pvp', 1))
        boxes.append(MouseBox(225, 420, 305, 115, 'highScore', 2))

        global volumeBoxes
        volumeBoxes = []
        for x in range(10):
            volumeBoxes.append(
                MouseBox(280 + 25 * x, 242, 18, 18, x + 1, x + 1))
예제 #2
0
    def renderDamage(self, renderer, xMin, yMin):

        #if there has been any change in health
        if (self.changeInHp != 0):
            #create the string
            stringDamage = str(self.changeInHp)
            #make it red
            color = sdl.Color((255, 0, 0)).cdata[0]
            #but if the "damage" is positive (ie, healing)
            if (self.changeInHp > 0):
                #show that it is positive
                stringDamage = "+" + str(self.changeInHp)
                #and make it green
                color = sdl.Color((0, 255, 0)).cdata[0]

            dmgSurf = sdl.ttf.renderText_Solid(driver.scoreFont, stringDamage,
                                               color)
            dmgTexture = renderer.createTextureFromSurface(dmgSurf)
            textureW, textureH = chef.textureSize(dmgTexture)
            dmgRect = sdl.Rect()
            dmgRect.x = int(self.xPos + textureW // 6 - xMin)
            dmgRect.y = int(self.yPos - textureH - yMin)
            dmgRect.w = textureW
            dmgRect.h = textureH
            dmgRect.x = int(dmgRect.x)
            dmgRect.y = int(dmgRect.y)
            sdl.renderCopy(renderer, dmgTexture, None, dmgRect)
            sdl.freeSurface(dmgSurf)
            sdl.destroyTexture(dmgTexture)
예제 #3
0
    def load(self):
        pauseImage = sdl.image.load("graphics/states/pause_menu.png")
        cursor = sdl.image.load("graphics/sprites/chef_idle_stroke.png")

        global pauseTexture
        pauseTexture = driver.renderer.createTextureFromSurface(pauseImage)
        sdl.freeSurface(pauseImage)

        global cursorTexture
        cursorTexture = driver.renderer.createTextureFromSurface(cursor)
        sdl.freeSurface(cursor)

        global scrollSound, selectSound
        sdl.mixer.allocateChannels(2)
        scrollSound = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile("music//chunks/menu_scroll.wav", 'rw'), 0)
        selectSound = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile("music//chunks/menu_select.wav", 'rw'), 0)

        global boxes
        boxes = []
        boxes.append(MouseBox(245, 220, 260, 60, 'resume', 0))
        boxes.append(MouseBox(245, 280, 320, 60, 'options', 1))
        boxes.append(MouseBox(245, 340, 260, 60, 'controls', 2))
        boxes.append(MouseBox(245, 400, 260, 60, 'quit', 3))
예제 #4
0
	def load(self):
		images = []
		if self.num is 1:
			images.append(sdl.image.load("graphics/story/intro_0.png"))
			images.append(sdl.image.load("graphics/story/intro_1.png"))
			images.append(sdl.image.load("graphics/story/intro_2.png"))
			images.append(sdl.image.load("graphics/story/intro_3.png"))
			images.append(sdl.image.load("graphics/states/level1.png"))
		elif self.num is 2:
			images.append(sdl.image.load("graphics/story/basement_0.png"))
			images.append(sdl.image.load("graphics/story/basement_1.png"))
		elif self.num is 3:
			images.append(sdl.image.load("graphics/states/level2.png"))
		elif self.num is 4:
			images.append(sdl.image.load("graphics/story/miniboss_0.png"))
			images.append(sdl.image.load("graphics/story/miniboss_1.png"))
		elif self.num is 5:
			images.append(sdl.image.load("graphics/states/level3.png"))
		elif self.num is 6:
			for x in range(0, 8):
				images.append(sdl.image.load('graphics/story/boss_' + str(x) + '.png'))
		elif self.num is 7:
			images.append(sdl.image.load("graphics/story/you_won.png"))
			images.append(sdl.image.load("graphics/states/credits.png"))
			global blackScreen
			blackScreen = driver.renderer.createTextureFromSurface(sdl.image.load('graphics/colors/black.png'))
			sdl.setTextureBlendMode(blackScreen,sdl.BLENDMODE_BLEND)
		self.length = len(images)
		for x in range(len(images)):
			self.textures.append(driver.renderer.createTextureFromSurface(images[x]))
			sdl.freeSurface(images[x])
		global textureRect
		textureW, textureH = game.textureSize(self.textures[0])
		textureRect = game.centeredRect(game.width, game.height, textureW, textureH)
예제 #5
0
def LoadTexture(renderer, file, transparent):
    # Load the sprite image
    rwops = sdl.RWFromFile(file, 'r')
    temp = sdl.loadBMP_RW(rwops, True)
    if temp == ffi.NULL:
        sys.stderr.write("Couldn't load %s: %s\n" % (file, sdl.getError()))
        return None

    # Set transparent pixel as the pixel at (0,0)
    if transparent:
        if temp.format.palette:
            sdl.setColorKey(temp, True, ffi.cast("uint8_t *", temp.pixels)[0])
        else:
            # TODO ffi.cast to correct-width type
            bpp = temp.format.BitsPerPixel
            if bbp == 15:
                sdl.setColorKey(temp, True, temp.pixels[0] & 0x00007FFF)
            elif bpp == 16:
                sdl.setColorKey(temp, sdl.TRUE, temp.pixels[0])
            elif bpp == 24:
                sdl.setColorKey(temp, True, temp.pixels[0] & 0x00FFFFFF)
            elif bpp == 32:
                sdl.setColorKey(temp, True, temp.pixels[0])

    # Create textures from the image
    texture = sdl.createTextureFromSurface(renderer, temp)
    sdl.freeSurface(temp)
    if not texture:
        sys.stderr.write("Couldn't create texture: %s\n" % (sdl.getError()))
        return None

    # We're ready to roll. :)
    return texture
예제 #6
0
  def load(self):

                background = sdl.image.load("graphics/states/menu.png")
                global textureBG
                textureBG = driver.renderer.createTextureFromSurface(background)
                sdl.freeSurface(background)

                cursor = sdl.image.load("graphics/sprites/chef_idle_stroke.png")
                global cursorTexture
                cursorTexture = driver.renderer.createTextureFromSurface(cursor)
                sdl.freeSurface(cursor)

                global music
                music = sdl.mixer.loadMUS("music/songs/menu_screen.mod")
                global scrollSound, selectSound
                sdl.mixer.allocateChannels(2)
                scrollSound = sdl.mixer.loadWAV_RW(sdl.RWFromFile("music//chunks/menu_scroll.wav", 'rw'), 0)
                selectSound = sdl.mixer.loadWAV_RW(sdl.RWFromFile("music//chunks/menu_select.wav", 'rw'), 0)
                global boxes
                boxes = []
                boxes.append(MouseBox(245,160,260,60, 'levelZero', 0))
                boxes.append(MouseBox(245, 280, 260, 60, 'highScore', 1))
                boxes.append(MouseBox(245, 340, 260, 60, 'options', 2))
                boxes.append(MouseBox(245, 400, 260, 60, 'controls', 3))
                boxes.append(MouseBox(245, 460, 260, 60, 'quit', 4))
예제 #7
0
 def renderScore(self, renderer):
     stringScore = "Score: " + str(self.totalScore)
     score = sdl.ttf.renderText_Solid(driver.scoreFont, stringScore,
                                      sdl.Color((255, 255, 255)).cdata[0])
     scoreTexture = renderer.createTextureFromSurface(score)
     textureW, textureH = game.textureSize(scoreTexture)
     scoreRect = game.centeredRect(game.width, 60, textureW, textureH)
     sdl.renderCopy(renderer, scoreTexture, None, scoreRect)
     sdl.freeSurface(score)
     sdl.destroyTexture(scoreTexture)
예제 #8
0
    def load(self, renderer):
        """Load the graphical data into textures compatible with renderer."""

        # mainly from pytmx.tmxloader
        tmxdata = self.tmx

        # convert angles to float:
        for ob in self.tmx.objects:
            ob.rotation = float(ob.rotation)

        for ts in tmxdata.tilesets:
            path = os.path.join(os.path.dirname(tmxdata.filename), ts.source)

            colorkey = getattr(ts, 'trans', None)
            if colorkey:
                # Convert HTML-format hex color to (r, g, b):
                colorkey = tuple(
                    int(colorkey[x:x + 2], 16) for x in range(0, 6, 2))

            surface = sdl.image.load(path)
            if not surface:
                raise Exception(sdl.getError())
            try:
                if colorkey and surface.format.BitsPerPixel == 8:
                    i = sdl.mapRGB(surface.format, *colorkey)
                    assert sdl.setColorKey(surface, 1, i) == 0
                ts.image = sdl.createTextureFromSurface(renderer, surface)
            finally:
                sdl.freeSurface(surface)
            rc, format, access, w, h = sdl.queryTexture(ts.image)

            # margins and spacing
            tilewidth = ts.tilewidth + ts.spacing
            tileheight = ts.tileheight + ts.spacing
            tile_size = ts.tilewidth, ts.tileheight

            # some tileset images may be slightly larger than the tile area
            # ie: may include a banner, copyright, etc.
            # this compensates for that
            width = int(((
                (w - ts.margin * 2 + ts.spacing) / tilewidth) * tilewidth) -
                        ts.spacing)
            height = int(((
                (h - ts.margin * 2 + ts.spacing) / tileheight) * tileheight) -
                         ts.spacing)

            # trim off any pixels on the right side that isn't a tile
            # this happens if extra graphics are included on the left,
            # but they are not actually part of the tileset
            width -= (w - ts.margin) % tilewidth

            # using product avoids the overhead of nested loops
            p = itertools.product(
                xrange(ts.margin, height + ts.margin, tileheight),
                xrange(ts.margin, width + ts.margin, tilewidth))
def load_resources():
    """
    Return a dictionary of our needed images; loaded, converted, and scaled.
    """
    images = {}

    knife_image = sdl.image.load("knife_hand.png")
    try:
        knife_w, knife_h = knife_image.w, knife_image.h
        knife_scale = (int(knife_w * SCALE), int(knife_h * SCALE))
        images["knife"] = renderer.createTextureFromSurface(knife_image)
    finally:
        sdl.freeSurface(knife_image)
    images["texture"] = sdl.image.loadTexture(renderer, 'wall_texture.jpg')
    sky_size = int(SCREEN_SIZE[0] * (CIRCLE / FIELD_OF_VIEW)), SCREEN_SIZE[1]
    sky_box_image = sdl.image.loadTexture(renderer, "deathvalley_panorama.jpg")
    images["sky"] = sky_box_image

    return images
예제 #10
0
def load_resources():
    """
    Return a dictionary of our needed images; loaded, converted, and scaled.
    """
    images = {}

    knife_image = sdl.image.load("knife_hand.png")
    try:
        knife_w, knife_h = knife_image.w, knife_image.h
        knife_scale = (int(knife_w*SCALE), int(knife_h*SCALE))
        images["knife"] = renderer.createTextureFromSurface(knife_image)
    finally:
        sdl.freeSurface(knife_image)
    images["texture"] = sdl.image.loadTexture(renderer, 'wall_texture.jpg')
    sky_size = int(SCREEN_SIZE[0]*(CIRCLE/FIELD_OF_VIEW)), SCREEN_SIZE[1]
    sky_box_image = sdl.image.loadTexture(renderer, "deathvalley_panorama.jpg")
    images["sky"] = sky_box_image

    return images
예제 #11
0
 def __init__(self, chef, chef2, mapOf, mapTextures, objects, enemies,
              emitters, width, height, ratTextures, structures, level, boss,
              bossTextures):
     self.chef = chef
     self.chef2 = chef2
     self.chef.addCamera(self)
     self.objects = objects
     self.enemies = enemies
     self.map = mapOf
     self.mapTextures = mapTextures
     self.xShift = 0.0
     self.yShift = 0
     self.xMin = 0.0  #left most camera screen pos
     self.yMin = 0.0
     self.width = width
     self.height = height
     self.ratTextures = ratTextures
     self.structures = structures
     self.top = False
     self.level = level
     self.emitters = emitters
     self.shake = False
     self.shakeTime = 0
     self.shakeIntensityX = 20
     self.shakeIntensityY = 20
     if level is 2:
         cmSurf = sdl.image.load("graphics/messages/carrot_message.png")
         self.cmTexture = driver.renderer.createTextureFromSurface(cmSurf)
         sdl.freeSurface(cmSurf)
     self.bossTextures = bossTextures
     self.boss = boss
     if level > 0:
         #self.blackScreenTexture = driver.renderer.createTextureFromSurface(sdl.image.load('graphics/ui/light.png'))
         #self.blackScreenTexture = driver.renderer.createTextureFromSurface(sdl.image.load('graphics/colors/black.png'))
         # self.blackScreenTexture = driver.renderer.createTextureFromSurface(sdl.image.load('graphics/ui/blueDark.png'))
         self.blackScreenTexture = driver.renderer.createTextureFromSurface(
             sdl.image.load('graphics/colors/darkGo.png'))
         sdl.setTextureBlendMode(self.blackScreenTexture, sdl.BLENDMODE_MOD)
예제 #12
0
 def load(self):
     loadingImage = sdl.image.load("graphics/states/loadingScreen.png")
     global loadingTexture
     loadingTexture = driver.renderer.createTextureFromSurface(loadingImage)
     sdl.freeSurface(loadingImage)
예제 #13
0
    def load(self):
        time = sdl.getTicks()

        # driver.loading.load()

        global music
        global ratDyingSound, getOut, hitGeneric, woosh
        global hit
        global ladleHit
        global story1, story2
        story1 = Story(1)
        story2 = Story(2)
        story1.load()
        story2.load()
        story1.run()

        # driver.loading.run()

        # assigning music channels

        sdl.mixer.allocateChannels(5)
        music = sdl.mixer.loadMUS('music/songs/level1music.xm')
        ratDyingSound = \
            sdl.mixer.loadWAV_RW(sdl.RWFromFile('music/chunks/rat_death.mp3'
                                 , 'rw'), 0)
        getOut = \
            sdl.mixer.loadWAV_RW(sdl.RWFromFile('music/chunks/get_out_you_dirty_rats.wav'
                                 , 'rw'), 0)

        hit = []
        for i in range(3):
            hit.append(
                sdl.mixer.loadWAV_RW(
                    sdl.RWFromFile('music/chunks/hit' + str(i) + '.wav', 'rw'),
                    0))
        ladleHit = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile('music/chunks/ladle_hit.wav', 'rw'), 0)
        hitGeneric = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile('music/chunks/hit.wav', 'rw'), 0)
        woosh = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile('music/chunks/woosh.wav', 'rw'), 0)

        ratImages = [
            sdl.image.load('graphics/sprites/rat_hurt.png'),  #0
            sdl.image.load('graphics/sprites/rat_up.png'),
            sdl.image.load('graphics/sprites/rat_right.png'),  #2
            sdl.image.load('graphics/sprites/rat_down.png'),
            sdl.image.load('graphics/sprites/rat_left.png'),  #4
            sdl.image.load('graphics/sprites/rat_attack_up.png'),
            sdl.image.load('graphics/sprites/rat_attack_right.png'),  #6
            sdl.image.load('graphics/sprites/rat_attack_down.png'),
            sdl.image.load('graphics/sprites/rat_attack_left.png'),  #8
            sdl.image.load('graphics/items/cheese.png'),
            sdl.image.load('graphics/ui/light.png'),  #10
        ]

        # array of tiles used throughout the map

        mapImages = []
        for x in range(1, 32):
            mapImages.append(sdl.image.load('graphics/map/' + str(x) + '.png'))

        objectImages = []
        objectImages.append(
            sdl.image.load('graphics/items/pizza_animation.png'))
        objectImages.append(
            sdl.image.load('graphics/items/heart_animation.png'))
        objectImages.append(
            sdl.image.load('graphics/items/carrot_animation.png'))
        objectImages.append(sdl.image.load('graphics/items/key_animation.png'))

        weaponImages = []
        weaponImages.append(sdl.image.load('graphics/items/ladles.png'))
        weaponImages.append(sdl.image.load('graphics/items/graters.png'))

        pantryImages = [
            sdl.image.load('graphics/items/open_pantry.png'),
            sdl.image.load('graphics/items/pantry_open.png'),
            sdl.image.load('graphics/messages/press_open.png'),
            sdl.image.load('graphics/items/open_pantry_key.png'),
            sdl.image.load('graphics/messages/found_key.png'),
            sdl.image.load('graphics/messages/basement_locked.png'),
        ]

        pantryTextures = []
        for x in range(len(pantryImages)):
            pantryTextures.append(
                driver.renderer.createTextureFromSurface(pantryImages[x]))
            sdl.freeSurface(pantryImages[x])

    # creates an array of arrays of integrets that represents our map's floor

        global map
        map = []
        with open('data/map.txt') as f:
            for line in f:
                currentLine = []
                split = line.split()
                for value in line.split():
                    currentLine.append(int(value))
                map.append(currentLine)

    # fill up the objects array which contains the objects that can be collided with

        global structures
        structures = []
        count = 0
        for j in range(len(map)):
            for i in range(len(map[j])):
                value = map[j][i]
                if value is 27:
                    if count is 0:
                        struct = Structure(
                            value,
                            i,
                            j,
                            pantryTextures,
                            True,
                            'pantry',
                        )
                        count += 1
                    else:
                        struct = Structure(
                            value,
                            i,
                            j,
                            pantryTextures,
                            False,
                            'pantry',
                        )
                    structures.append(struct)
                elif value is (2 or 3):
                    structures.append(
                        Structure(
                            value,
                            i,
                            j,
                            pantryTextures,
                            False,
                            'stairs',
                        ))
                elif value is not 1:
                    structures.append(
                        Structure(
                            value,
                            i,
                            j,
                            None,
                            False,
                            None,
                        ))

        #a graph of every tile mapped to every one of its neighbors

        self.navGraph = navGraph.navGraph(map, {1}, 1)

        # for now just stuff that's dropped by the rats

        global objects
        objects = []

        global objectTextures
        objectTextures = []
        for x in range(len(objectImages)):
            objectTextures.append(
                driver.renderer.createTextureFromSurface(objectImages[x]))
            sdl.freeSurface(objectImages[x])
        for x in range(len(weaponImages)):
            objectTextures.append(
                driver.renderer.createTextureFromSurface(weaponImages[x]))
            sdl.freeSurface(weaponImages[x])

        global ratTextures
        ratTextures = []
        for x in range(len(ratImages)):
            ratTextures.append(
                driver.renderer.createTextureFromSurface(ratImages[x]))
            sdl.freeSurface(ratImages[x])

        global mapTextures
        mapTextures = []
        for x in range(len(mapImages)):
            mapTextures.append(
                driver.renderer.createTextureFromSurface(mapImages[x]))
            sdl.freeSurface(mapImages[x])

        driver.scoreBoard.clearScore()
        driver.scoreBoard.updateScore(100000)
예제 #14
0
    def load(self):
        time = sdl.getTicks()

        # driver.loading.load()

        global music
        global hit
        global ladleHit, graterHit, hitGeneric
        global explosionSound
        global ratDyingSound, woosh
        global haveCarrot, needCarrot

        # driver.loading.run()

        story = Story(3)
        story.load()
        story.run()

        sdl.mixer.allocateChannels(4)
        music = sdl.mixer.loadMUS('music/songs/2.mod')
        hit = []
        for i in range(3):
            hit.append(
                sdl.mixer.loadWAV_RW(
                    sdl.RWFromFile('music/chunks/hit' + str(i) + '.wav', 'rw'),
                    0))
        explosionSound = \
            sdl.mixer.loadWAV_RW(sdl.RWFromFile('music/chunks/explosion.wav'
                                 , 'rw'), 0)
        ratDyingSound = \
            sdl.mixer.loadWAV_RW(sdl.RWFromFile('music/chunks/rat_death.mp3'
                                 , 'rw'), 0)
        haveCarrot = \
            sdl.mixer.loadWAV_RW(sdl.RWFromFile('music/chunks/carrot_lets_me_see.wav'
                                 , 'rw'), 0)
        needCarrot = \
            sdl.mixer.loadWAV_RW(sdl.RWFromFile('music/chunks/need_a_carrot.wav'
                                 , 'rw'), 0)
        ladleHit = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile('music/chunks/ladle_hit.wav', 'rw'), 0)
        graterHit = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile('music/chunks/grater_hit.wav', 'rw'), 0)
        hitGeneric = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile('music/chunks/hit.wav', 'rw'), 0)
        woosh = sdl.mixer.loadWAV_RW(
            sdl.RWFromFile('music/chunks/woosh.wav', 'rw'), 0)

        ratImages = [
            sdl.image.load('graphics/sprites/rat_hurt.png'),
            sdl.image.load('graphics/sprites/rat_up.png'),
            sdl.image.load('graphics/sprites/rat_right.png'),
            sdl.image.load('graphics/sprites/rat_down.png'),
            sdl.image.load('graphics/sprites/rat_left.png'),
            sdl.image.load('graphics/sprites/rat_attack_up.png'),
            sdl.image.load('graphics/sprites/rat_attack_right.png'),
            sdl.image.load('graphics/sprites/rat_attack_down.png'),
            sdl.image.load('graphics/sprites/rat_attack_left.png'),
            sdl.image.load('graphics/items/cheese.png'),
        ]

        # array of tiles used throughout the map

        mapImages = []
        for x in range(1, 32):
            mapImages.append(
                sdl.image.load('graphics/map/level_2/' + str(x) + '.png'))

        objectImages = []
        objectImages.append(
            sdl.image.load('graphics/items/pizza_animation.png'))
        objectImages.append(
            sdl.image.load('graphics/items/heart_animation.png'))
        objectImages.append(
            sdl.image.load('graphics/items/carrot_animation.png'))
        objectImages.append(sdl.image.load('graphics/items/key_animation.png'))
        objectImages.append(
            sdl.image.load('graphics/items/bomb_animation.png'))

        pantryImages = [
            sdl.image.load('graphics/items/lvl2_open_pantry.png'),
            sdl.image.load('graphics/items/lvl2_pantry_open.png'),
            sdl.image.load('graphics/messages/press_open.png'),
            sdl.image.load('graphics/items/open_pantry_key.png'),
            sdl.image.load('graphics/messages/found_key.png'),
            sdl.image.load('graphics/messages/basement_locked.png'),
            sdl.image.load('graphics/messages/found_graters.png'),
        ]

        weaponImages = []
        weaponImages.append(sdl.image.load('graphics/items/ladles.png'))
        weaponImages.append(sdl.image.load('graphics/items/graters.png'))

        pantryTextures = []
        for x in range(len(pantryImages)):
            pantryTextures.append(
                driver.renderer.createTextureFromSurface(pantryImages[x]))
            sdl.freeSurface(pantryImages[x])

    # creates an array of arrays of integrets that represents our map's floor

        global map
        map = []
        with open('data/level2.txt') as f:
            for line in f:
                currentLine = []
                split = line.split()
                for value in line.split():
                    currentLine.append(int(value))
                map.append(currentLine)

    # fill up the objects array which contains the objects that can be collided with

        global structures
        structures = []
        global exit
        for j in range(len(map)):
            for i in range(len(map[j])):
                value = map[j][i]
                if value is 31:
                    struct = Structure(
                        value,
                        i,
                        j,
                        pantryTextures,
                        False,
                        'pantry',
                    )
                    structures.append(struct)
                if value is 1:
                    exit = Structure(
                        value,
                        i,
                        j,
                        None,
                        False,
                        'exit',
                    )

        self.navGraph = navGraph.navGraph(map, {3}, 2)

        # for now just stuff that's dropped by the rats + the carrot

        global objects
        objects = []

        global objectTextures
        objectTextures = []
        for x in range(len(objectImages)):
            objectTextures.append(
                driver.renderer.createTextureFromSurface(objectImages[x]))
            sdl.freeSurface(objectImages[x])
        for x in range(len(weaponImages)):
            objectTextures.append(
                driver.renderer.createTextureFromSurface(weaponImages[x]))
            sdl.freeSurface(weaponImages[x])

        global ratTextures
        ratTextures = []
        for x in range(len(ratImages)):
            ratTextures.append(
                driver.renderer.createTextureFromSurface(ratImages[x]))
            sdl.freeSurface(ratImages[x])

        global mapTextures
        limitedVisionTexture1 = \
            driver.renderer.createTextureFromSurface(sdl.image.load('graphics/ui/limited_vision1.png'
                ))
        limitedVisionTexture2 = \
            driver.renderer.createTextureFromSurface(sdl.image.load('graphics/ui/limited_vision2.png'
                ))
        mapTextures = []
        for x in range(len(mapImages)):
            mapTextures.append(
                driver.renderer.createTextureFromSurface(mapImages[x]))
            sdl.freeSurface(mapImages[x])
        mapTextures.append(limitedVisionTexture1)
        mapTextures.append(limitedVisionTexture2)

        # set the current score to waht it was plus 100000

        driver.scoreBoard.setScore(driver.chef.score + 100000)
        story.cleanup()
 def load(self):
     background = sdl.image.load("graphics/states/controls.png")
     global backgroundTexture
     backgroundTexture = driver.renderer.createTextureFromSurface(
         background)
     sdl.freeSurface(background)
예제 #16
0
 def load(self):
     gameOverString = "GAME OVER"
     gameOver = sdl.image.load("graphics/story/you_lost.png")
     global gameOverTexture
     gameOverTexture = driver.renderer.createTextureFromSurface(gameOver)
     sdl.freeSurface(gameOver)
예제 #17
0
 def load(self):
     winString = "YOU WON"
     winScreen = sdl.image.load("graphics/story/you_won.png")
     global winTexture
     winTexture = driver.renderer.createTextureFromSurface(winScreen)
     sdl.freeSurface(winScreen)