Beispiel #1
0
def event_1(current):
    if (npcs['witch2']):
        npcs['witch2'].location = current
        npcs['shadow5'] = npc.NPC("Shadow 5", current)
    else:
        npcs['shadow5'] = npc.NPC("Shadow 5", current)
        npcs['shadow6'] = npc.NPC("Shadow 6", current)
        npcs['shadow7'] = npc.NPC("Shadow 7*", current)
        npcs['shadow8'] = npc.NPC("Shadow 8", current)
    throw_npc_exception(current, True)
Beispiel #2
0
 def level2(self):
     return [gameObject.Object(-100,-100,400),
         gameObject.Object(200,-100,100,150),
         gameObject.Object(300,-100,100,120),
         movingPlatform.MovingPlatform(300,-100,50,130),
         movingPlatform.MovingPlatform(600,-100,50,100, True, 100, 7),
         gameObject.Object(400,-100,50,110),
         gameObject.Object(300,-100,800),
         gameObject.Object(1100,-100,100,600),
         npc.NPC(500,40),
         npc.NPC(700,40, active = True)]
    def __init__(self, redis, features={}):

        Generator.__init__(self, redis, features)
        self.logger = logging.getLogger(__name__)

        self.generate_features('motivation' + self.kind)

        if not hasattr(self, 'npc'):
            self.npc = npc.NPC(self.redis, {'motivation': self})

        self.text = self.render_template(self.text)
Beispiel #4
0
 def loadNPCs(self, filename):
     npc_index = 0
     data = self.loadData(filename)
     for row, tiles in enumerate(data):
                 for col, tile in enumerate(tiles):
                     if int(tile) > -1:
                         ent = npc.NPC(col * self.tileHeight, row * self.tileWidth, self.get_tile(int(tile)), 1, 0, 0, 0, 0, 0, 0)
                         self.level.NPC_LAYER.add(ent)
                         self.level.npc_sprites[str(npc_index)] = ent
                         self.level.solid_sprites[(col, -row)] = ent
                         ent.setText("NPC index: " + str(npc_index))
                         npc_index += 1
Beispiel #5
0
 def action_test(self, player):
     for i in self.triggers:  # talks to npc
         if collide.collision_test(player.rect, i):
             for j in self.npcs.sprites():
                 if j.npc_id == i.npc_id:
                     self.foo = j.interact()
                     if j.activate:
                         self.activate = True
                         self.npcs.add(
                             npc.NPC(
                                 pygame.image.load(
                                     "resources/scientist.png"),
                                 (448, 16, 64, 64), 1,
                                 "resources/npc_fitting.txt"))
                     if j.end:
                         self.end = True
                     tuple = (self.foo, self.activate, self.end)
                     return tuple
Beispiel #6
0
    def __init__(self, redis, features={}):
        Generator.__init__(self, redis, features)
        self.logger = logging.getLogger(__name__)

        # if self.you and self.other are not set, set them to defaults.
        if not hasattr(self, 'you'):
            self.you = 'you'

        # a random NPC
        if not hasattr(self, 'other'):
            self.other = npc.NPC(self.redis).name.fullname

        # We put you and other in an array so we can randomly select
        # who is the subject and who is the object.

        members = [self.you, self.other]
        random.shuffle(members)
        if not hasattr(self, 'either'):
            self.either = members[0]
        random.shuffle(members)

        # We use partyA/partyB syntax in the templates

        if not hasattr(self, 'partyA'):
            self.partyA = members.pop()
        if not hasattr(self, 'partyB'):
            self.partyB = members.pop()

        # If we don't already have text, we need to render a template

        if not hasattr(self, 'text'):

            # if we have it, we need to add a "when" as well

            if hasattr(self, 'when'):
                self.template = self.when + ', ' + self.template
            self.text = self.render_template(self.template)

        # final sentence is stored as self.text.
        # note the need for capitalization of the first character

        self.text = self.text[0].capitalize() + self.text[1:]
Beispiel #7
0
	def LoadSprites(self):
		"""Load all of the sprites that we need"""

		"""Load textures"""
		img_list = self.level.getSprites()

		"""Create the group of block sprites"""
		self.sprites_block = pygame.sprite.Group()

		"""Create the group of pellet sprites"""
		self.sprites_pellet = pygame.sprite.Group()

		"""Create the group of super-pellet sprites"""
		self.sprites_spellet = pygame.sprite.Group()

		"""Create the group of npc sprites"""
		self.sprites_npc = pygame.sprite.Group()

		for y in range(len(self.layout)):
			for x in range(len(self.layout[y])):
				if self.layout[y][x][1] == self.level.BLOCK:
					block = basicSprite.Sprite(self.layout[y][x][0], img_list[self.level.BLOCK])
					self.sprites_block.add(block)
				elif self.layout[y][x][1] == self.level.CHARACTER:
					self.character = Character(self.layout[y][x][0], img_list[self.level.CHARACTER])
				elif self.layout[y][x][1] == self.level.PELLET:
					pellet = basicSprite.Sprite(self.layout[y][x][0], img_list[self.level.PELLET])
					self.sprites_pellet.add(pellet)
				elif self.layout[y][x][1] == self.level.SPELLET:
					spellet = basicSprite.Sprite(self.layout[y][x][0], img_list[self.level.SPELLET])
					self.sprites_spellet.add(spellet)
				elif self.layout[y][x][1] == self.level.NPC:
					self.npc = npc.NPC(self.layout[y][x][0], img_list[self.level.NPC])
					self.sprites_npc.add(self.npc)

		"""Create the Snake group"""
		self.sprites_character = pygame.sprite.RenderPlain(self.character)
        os.environ['SDL_VIDEO_WINDOW_POS'] = f'{(tk.Tk().winfo_screenwidth() - SETTINGS.WIDTH) // 2},' \
                                             f'{(tk.Tk().winfo_screenheight() - SETTINGS.HEIGHT) // 4}'
        pygame.init()
        pygame.display.set_caption('Ray casting')

        sc = pygame.display.set_mode(SETTINGS.SIZE)
        sc_map = pygame.Surface(SETTINGS.map_size)

        clock = pygame.time.Clock()
        pygame.mouse.set_visible(False)

        map = map.Map()
        player = player_test.TestPlayer(map.flat_map)
        render = render.Render(sc, sc_map)

        npc_0 = npc.NPC(sc, (4062, 1270), 'bruda')
        npc_1 = npc.NPC(sc, (3936, 570), 'bruda_1')
        npc_2 = npc.NPC(sc, (4417, 554), 'bruda_2')
        npc_3 = npc.NPC(sc, (721, 841), 'bruda_3')
        npc_4 = npc.NPC(sc, (719, 595), 'bruda_4')

        ray_cast = raycast_mp.RayCast(map.map)

        with Pool(processes=4) as pool:

            fps = []

            t = time.time()
            for i, v in enumerate(test_128.test_list, 0):

                sc.fill(SETTINGS.BLACK)
Beispiel #9
0
    def __init__(self, fn):
        """
      Open the map data file, set border tiles and connections, and add NPCs and other events.

      fn - the filename of the map XML file.
      """

        #for the scripting engine
        script_engine.ScriptableObject.__init__(self)

        #store variables we'll need later
        self.fn = fn

        #get a script engine (singleton)
        self.scriptEngine = script_engine.ScriptEngine()

        #parse the XML file
        root = data.getTreeRoot(fn)
        self.music = os.path.join(settings.path, "data",
                                  data.getAttr(root, "music", data.D_STRING))

        #open the actual map data file to create the map tile data
        mapPath = os.path.join(settings.path, "data",
                               data.getAttr(root, "file", data.D_STRING))
        self.openMap(mapPath)

        #create the tileset
        tilesetPath = os.path.join(
            settings.path, "data", data.getAttr(root, "tileset",
                                                data.D_STRING))
        self.tileset = tileset.Tileset(tilesetPath)

        #set the border tiles
        self.borderTiles = {}
        borderNode = data.getChild(root, "border")

        #set each border node with the correct tile indexes, subtracting 1 because the tileset starts at 1 not 0
        self.borderTiles[BD_NW] = data.getAttr(borderNode, "nw",
                                               data.D_INT) - 1
        self.borderTiles[BD_NE] = data.getAttr(borderNode, "ne",
                                               data.D_INT) - 1
        self.borderTiles[BD_SW] = data.getAttr(borderNode, "sw",
                                               data.D_INT) - 1
        self.borderTiles[BD_SE] = data.getAttr(borderNode, "se",
                                               data.D_INT) - 1

        #create any connections from the map
        #connected maps will not be loaded until the map becomes the main game map
        #connections are stored as {direction: (filename, offset)}
        self.connections = {}
        self.connectedMaps = {}
        for c in data.getChildren(root, "connection"):
            side = data.getAttr(c, "side", data.D_STRING)
            fp = os.path.join(settings.path, "data",
                              data.getAttr(c, "map", data.D_STRING))
            offset = data.getAttr(c, "offset", data.D_INT)

            if side == "left":
                self.connections[sprite.DIR_LEFT] = (fp, offset)
            elif side == "right":
                self.connections[sprite.DIR_RIGHT] = (fp, offset)
            elif side == "up":
                self.connections[sprite.DIR_UP] = (fp, offset)
            elif side == "down":
                self.connections[sprite.DIR_DOWN] = (fp, offset)

        #create any NPCs, adding them to the sprite dictionary
        self.sprites = {}
        for n in data.getChildren(root, "npc"):
            spr = npc.NPC(n, self)
            self.sprites[spr.id] = spr

        #create a dictionary to hold positions reserved by moving sprites
        self.reservedPositions = {}

        #create script and warp events, adding them to the events dictionary
        #if a load script is defined, create it
        self.events = {}
        loadScript = None
        for s in data.getChildren(root, "script"):
            trigger = data.getAttr(s, "trigger", data.D_STRING)
            if trigger == "load":
                loadScript = script_engine.Script(s)
            else:
                position = tuple(data.getAttr(s, "position", data.D_INT2LIST))
                self.events[position] = events.ScriptEvent(s, self)

        for w in root.findall("warp"):
            position = tuple(data.getAttr(w, "position", data.D_INT2LIST))
            self.events[position] = events.Warp(w, self)

        #if there is a load script, run it
        if loadScript is not None:
            self.scriptEngine.run(loadScript, self)
         "Who can you write in for the presidential candidate?": ["[A] Kanye West", "[B] Your mom", "[C] Your school principal", "[D] All of the above"],
         "How should you research candidates?": ["[A] Don't, just pick randomly.","[B] Only look from one news site", "[C] Check a variety of sources with different views", "[D] Ask your parents"]}
ans2 = ["D","D","C"]
ansInd2 = [3,3,2]
quiz3 = {"When does early voting occur in NYS?": ["[A] It doesn't","[B] October 2 - November 3", "[C] October 24 - November 3","[D] None of the above"],
         "How can you request a mail in ballot?": ["[A] Following the steps in websites like voteearlyny.org","[B] Through your local election office","[C] Going to vote.org and filling out the application online", "[D] All of the above"],
         "When is election day?": ["[A] November 3", "[B] November 1", "[C] October 31", "[D] All of the above"]}
ans3 = ["C","D","A"]
ansInd3 = [2,3,0]

q1 = Quiz(screen,quiz1,ans1,ansInd1,0,1)
q2 = Quiz(screen, quiz2, ans2, ansInd2, 0, 1)
q3 = Quiz(screen, quiz3, ans3, ansInd3, 0, 1)

Y = 460
npc1 = npc.NPC("man1.png",235, Y, q1)
npc2 = npc.NPC("man2.png", 690, Y, q2)
npc3 = npc.NPC("person2.png", 1140, Y, q3)

p1 = Player("person1.png", 20, Y)

npcs = [npc1, npc2, npc3]
quizzes = [q1, q2, q3]

currentquiz = q1

def text_objects(text, font):
    black = (0, 0, 0)
    textSurface = font.render(text, True, black)
    return textSurface, textSurface.get_rect()
def voted():
Beispiel #11
0
def init_npcs():
    npcs['witch1'] = npc.NPC("Witch 1", rooms[17], False)
    npcs['witch2'] = npc.NPC("Witch 2", rooms[3])
    npcs['shadow1'] = npc.NPC("Shadow 1", rooms[3])
    npcs['shadow2'] = npc.NPC("Shadow 2", rooms[3])
    npcs['shadow3'] = npc.NPC("Shadow 3", rooms[3])

    monsters['beast'] = npc.NPC("Displacer Beast", rooms[26], False, 4)
    monsters['cube'] = npc.NPC("Gelatinous Cube", rooms[27], False, 7)
    monsters['ithilid'] = npc.NPC("Ithilid", rooms[28], False, 2)  # Int rolls?
    monsters['rust'] = npc.NPC("Rust Monster", rooms[29], False,
                               8)  # Eats weapons
    monsters['grue'] = npc.NPC("Grue", rooms[30], False,
                               3)  # Casts magical darkness, never seen
    monsters['xorn'] = npc.NPC("Xorn", rooms[31], False, 4)  # Eats magic items
Beispiel #12
0
print("Loading map")
terrain_default = map.tileset("assets/graphics/overworld.png", 32,
                              32)  # Creates a tileset for map tiles
current_map_name = "dungeon_roofs"  # The name of the json file that the map data is stored in
current_map = map.Map("maps/" + current_map_name + ".json", terrain_default)
current_map.load_collisions()

# player object
spawn_location_x = 64  # Where to spawn the player (to later be set by map data
spawn_location_y = 32
player = player.Player()

# npc objects
print("Loading NPCs")
npc_list = []  # Will later contain all NPC objects / load from map data file
npc1 = npc.NPC("test")

# spawning players and NPCs
player.spawn(world, spawn_location_x,
             spawn_location_y)  # spawn the player on the map at position x , y
npc1.spawn(world, 64, 64)
'''
# START GAME LOOP
'''

run = True
start_time = None  # this is used to make things happen for x amount of time
while run:
    pygame.time.delay(int(1000 / fps))  # frame refresh rate

    # Player movement, see movement.txt in dev manual
Beispiel #13
0
    pygame.image.load("resc/images/lab.png").convert())
__builtin__.g_player_house_down_tilemap = tilemap.Tilemap(
    "player_house_down.map", [0, 0],
    pygame.image.load("resc/images/player_house_down.png").convert())
__builtin__.g_player_house_up_tilemap = tilemap.Tilemap(
    "player_house_up.map", [0, 0],
    pygame.image.load("resc/images/player_house_up.png").convert())
__builtin__.g_route_tilemap = tilemap.Tilemap("route.map", [0, -64 * 64], 0)

# Create the player object.
__builtin__.g_player = player.Player(
    [240 * 4 / 2 - 8 * 4, 160 * 4 / 2 - 4 * 4])

# Create oak, and add his different images to a list
__builtin__.g_oak_grass = npc.NPC([1152, -64],
                                  pygame.image.load("resc\images\g_oak.png"),
                                  True, 0)
__builtin__.g_oak_lab = npc.NPC([448, 256],
                                pygame.image.load("resc\images\g_oak.png"),
                                False, 0)
__builtin__.g_oak_list = [g_oak_grass, g_oak_lab]

#Create rest of the npc/trainers
__builtin__.g_trainer_one = npc.NPC(
    [1792, -656], pygame.image.load("resc\images\g_trainer.png"), False, 0)

# Create the menu class.
g_menu = menu.Menu(DISPLAY_SURFACE)
g_story = story.Story(DISPLAY_SURFACE)

Beispiel #14
0
def event_2(current):
    npcs['highchurch'] = npc.NPC("Captain Highchurch", rooms[8])
    npcs['soldier1'] = npc.NPC("Solider 1", rooms[8])
    npcs['soldier2'] = npc.NPC("Solider 2", rooms[8])
    npcs['soldier3'] = npc.NPC("Solider 3", rooms[8])
    npcs['soldier4'] = npc.NPC("Solider 4", rooms[9])
    npcs['soldier5'] = npc.NPC("Solider 5", rooms[10])
    npcs['soldier6'] = npc.NPC("Solider 6", rooms[1])
    npcs['soldier7'] = npc.NPC("Solider 7", rooms[1])
    npcs['soldier8'] = npc.NPC("Solider 8", rooms[1])
    npcs['soldier9'] = npc.NPC("Solider 9", rooms[15])
    npcs['soldier10'] = npc.NPC("Solider 10", rooms[15])
    npcs['soldier11'] = npc.NPC("Solider 1", rooms[4])
    npcs['soldier12'] = npc.NPC("Solider 1", rooms[4])
    throw_npc_exception(current, True)
Beispiel #15
0
    def __init__(self, room):
        self.tiles = pygame.sprite.Group()
        self.doors = pygame.sprite.Group()
        self.npcs = pygame.sprite.Group()
        self.triggers = pygame.sprite.Group()
        self.floor = pygame.sprite.Group()

        self.activate = False
        self.end = False

        file = open(room, "r")
        data = file.read()
        file.close()

        self.foo = " "

        x_cursor = 0
        y_cursor = 0

        tile_size = 64

        data_setx = data.splitlines()

        for i in data_setx:
            data_sety = list(i)
            x_cursor = 0

            for j in data_sety:
                if j == "H":
                    self.tiles.add(
                        entity.Tile(
                            pygame.image.load("resources/wall.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                if j == "W":
                    self.tiles.add(
                        entity.Tile(
                            pygame.image.load("resources/water.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == " ":
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "0":
                    self.doors.add(
                        entity.Door(pygame.image.load("resources/tile.png"),
                                    (x_cursor, y_cursor, tile_size, tile_size),
                                    1, (0, 64), (True, False)))
                elif j == "1":
                    self.doors.add(
                        entity.Door(pygame.image.load("resources/tile.png"),
                                    (x_cursor, y_cursor, tile_size, tile_size),
                                    0, (0, 542), (True, False)))
                elif j == "2":
                    self.doors.add(
                        entity.Door(pygame.image.load("resources/tile.png"),
                                    (x_cursor, y_cursor, tile_size, tile_size),
                                    2, (64, 0), (False, True)))
                elif j == "3":
                    self.doors.add(
                        entity.Door(pygame.image.load("resources/tile.png"),
                                    (x_cursor, y_cursor, tile_size, tile_size),
                                    1, (896, 0), (False, True)))
                elif j == "4":
                    self.doors.add(
                        entity.Door(pygame.image.load("resources/tile.png"),
                                    (x_cursor, y_cursor, tile_size, tile_size),
                                    3, (64, 0), (False, True)))
                elif j == "5":
                    self.doors.add(
                        entity.Door(pygame.image.load("resources/tile.png"),
                                    (x_cursor, y_cursor, tile_size, tile_size),
                                    2, (896, 0), (False, True)))
                elif j == "6":
                    self.doors.add(
                        entity.Door(pygame.image.load("resources/tile.png"),
                                    (x_cursor, y_cursor, tile_size, tile_size),
                                    4, (64, 0), (False, True)))
                elif j == "7":
                    self.doors.add(
                        entity.Door(pygame.image.load("resources/tile.png"),
                                    (x_cursor, y_cursor, tile_size, tile_size),
                                    3, (896, 0), (False, True)))
                elif j == "8":
                    self.doors.add(
                        entity.Door(pygame.image.load("resources/tile.png"),
                                    (x_cursor, y_cursor, tile_size, tile_size),
                                    5, (0, 64), (True, False)))
                elif j == "9":
                    self.doors.add(
                        entity.Door(pygame.image.load("resources/tile.png"),
                                    (x_cursor, y_cursor, tile_size, tile_size),
                                    4, (0, 542), (True, False)))
                elif j == "A":
                    self.npcs.add(
                        npc.NPC(pygame.image.load("resources/scientist.png"),
                                (x_cursor, y_cursor, tile_size, tile_size), 0,
                                "resources/npc_reject.txt"))
                    self.tiles.add(
                        entity.Tile(
                            pygame.image.load("resources/blank64x80.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "a":
                    self.triggers.add(
                        entity.TriggerTile(
                            pygame.image.load("resources/blank.png"),
                            (x_cursor, y_cursor, tile_size, tile_size), 0))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "B":
                    self.npcs.add(
                        npc.NPC(pygame.image.load("resources/scientist.png"),
                                (x_cursor, y_cursor, tile_size, tile_size), 1,
                                "resources/npc_nursery.txt"))
                    self.tiles.add(
                        entity.Tile(
                            pygame.image.load("resources/blank64x80.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "b":
                    self.triggers.add(
                        entity.TriggerTile(
                            pygame.image.load("resources/blank.png"),
                            (x_cursor, y_cursor, tile_size, tile_size), 1))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "C":
                    self.npcs.add(
                        npc.NPC(pygame.image.load("resources/scientist.png"),
                                (x_cursor, y_cursor, tile_size, tile_size), 1,
                                "resources/npc_boiler.txt"))
                    self.tiles.add(
                        entity.Tile(
                            pygame.image.load("resources/blank64x80.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "c":
                    self.triggers.add(
                        entity.TriggerTile(
                            pygame.image.load("resources/blank.png"),
                            (x_cursor, y_cursor, tile_size, tile_size), 1))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "D":
                    self.npcs.add(
                        npc.NPC(pygame.image.load("resources/scientist.png"),
                                (x_cursor, y_cursor, tile_size, tile_size), 1,
                                "resources/npc_bottle.txt"))
                    self.tiles.add(
                        entity.Tile(
                            pygame.image.load("resources/blank64x80.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "d":
                    self.triggers.add(
                        entity.TriggerTile(
                            pygame.image.load("resources/blank.png"),
                            (x_cursor, y_cursor, tile_size, tile_size), 1))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "E":
                    self.npcs.add(
                        npc.NPC(pygame.image.load("resources/scientist.png"),
                                (x_cursor, y_cursor, tile_size, tile_size), 1,
                                "resources/npc_fitting.txt"))
                    self.tiles.add(
                        entity.Tile(
                            pygame.image.load("resources/blank64x80.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "e":
                    self.triggers.add(
                        entity.TriggerTile(
                            pygame.image.load("resources/blank.png"),
                            (x_cursor, y_cursor, tile_size, tile_size), 1))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "F":
                    self.npcs.add(
                        npc.NPC(pygame.image.load("resources/water.png"),
                                (x_cursor, y_cursor, tile_size, tile_size), 1,
                                "resources/npc_computer.txt"))
                    self.tiles.add(
                        entity.Tile(
                            pygame.image.load("resources/blank.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))
                elif j == "f":
                    self.triggers.add(
                        entity.TriggerTile(
                            pygame.image.load("resources/blank.png"),
                            (x_cursor, y_cursor, tile_size, tile_size), 1))
                    self.floor.add(
                        entity.Tile(
                            pygame.image.load("resources/tile.png"),
                            (x_cursor, y_cursor, tile_size, tile_size)))

                x_cursor += tile_size
            y_cursor += tile_size
Beispiel #16
0
 def inhabit_society(self, n_npc, n_food):
     self.npcs = [npc.NPC(self, male=i % 2 == 0) for i in range(n_npc)]
     self.food = [
         food.Food(pygame.image.load('./img/food.jpg'), self)
         for i in range(n_food)
     ]
def interface(location):
    for char in location.inhabList() + [location.getPlayer()]:
        if not char.isAlive(): continue
        char.startThread()
    #Game.startThread(location.inhabList()+[location.getPlayer()]) #allows for rudimentary Display - buggy
    while location.getPlayer().isAlive() and any(location.inhabList()):
        pass

    for char in location.inhabList() + [location.getPlayer()]:
        char._alive = False

    print("Done!")


if __name__ == "__main__":
    location = locations.Location()
    character = npc.NPC("Steve", location)
    char2 = npc.NPC("Mitch", location)
    player = player.Player("Jim", location)
    location.addPlayer(player)
    location.addInhab(character)
    location.addInhab(char2)
    #stick = weapons.Weapon(name="stick", damage={'sides':4,'num':2})
    jerkin = armour.Armour(name="jerkin", aRating=20, armClass="torso")
    #roboArm = augments.Augment(name="Robotic Arm", mod={'str': 500, 'agi':500, 'con': 0}, augClass='muscle')
    #player.equip(stick)
    player.equip(jerkin)
    #player.equip(roboArm)
    interface(location)