コード例 #1
0
ファイル: TriggerTest.py プロジェクト: sxdxs/fifengine
    def createTrigger(self):
        layer = self._player.getLocationRef().getLayer()
        grasscoords = (fife.ModelCoordinate(-3,
                                            -1), fife.ModelCoordinate(-1, 6),
                       fife.ModelCoordinate(3, -2))
        trigger = self._triggercontroller.createTriggerOnCoordinates(
            "grass", layer, grasscoords)
        self.grasslistener = TriggerListener(trigger, "Caution! Grass")
        trigger.addTriggerListener(self.grasslistener)
        trigger.addTriggerCondition(fife.CELL_TRIGGER_ENTER)
        trigger.enableForAllInstances()

        trigger = self._triggercontroller.createTriggerOnCoordinate(
            "flower", layer, fife.ModelCoordinate(3, 1))
        self.flowerlistener = TriggerListener(trigger, "The poor flower :/")
        trigger.addTriggerListener(self.flowerlistener)
        trigger.addTriggerCondition(fife.CELL_TRIGGER_ENTER)
        trigger.enableForAllInstances()

        trigger = self._triggercontroller.createTriggerOnInstance(
            "player", self._player)
        self.pclistener = TriggerListener(trigger,
                                          "You walked into the next cell.")
        trigger.addTriggerListener(self.pclistener)
        trigger.addTriggerCondition(fife.INSTANCE_TRIGGER_CELL)
コード例 #2
0
ファイル: cutscenes.py プロジェクト: Niektory/steamfolktales
	def cutsceneScript(self):
		self.application.gui.intro_text.showFade("Two Maples Inn, Ashgrove")
		while self.elapsed_time < 6000:
			yield
		self.application.gui.intro_text.hideFade()
		while self.elapsed_time < 13000:
			yield
		radcliffe = self.application.world.getCharacter("Radcliffe")
		loc = radcliffe.visual.instance.getLocation()
		loc.setLayerCoordinates(fife.ModelCoordinate(-3,-2,0))
		radcliffe.visual.walk(loc)
		while self.elapsed_time < 18000:
			yield
		radcliffe.visual.say(u"“Good evening, young sirs and young lady.\n\
			Master Rex informed me that he will be somewhat delayed\n\
			by what he referred to as “a delicate process in his laboratory”.\n\
			He asked me to relay his sincerest expression of apologies to you\n\
			and that he will join you as soon as he is able.”", 9000)
		while self.elapsed_time < 27000:
			yield
		loc.setLayerCoordinates(fife.ModelCoordinate(-3,3,0))
		radcliffe.visual.walk(loc)
		while self.elapsed_time < 30500:
			yield
		radcliffe.rotation = 0
		while self.elapsed_time < 31000:
			yield
コード例 #3
0
ファイル: cutscenes.py プロジェクト: Niektory/steamfolktales
	def cutsceneScript(self):
		sebastian = self.application.world.getCharacter("Sebastian_Dustys")
		sebastian.teleport(fife.ModelCoordinate(-2,4,0), "Amelia_Engineroom")
		yield
		loc = sebastian.visual.instance.getLocation()
		loc.setLayerCoordinates(fife.ModelCoordinate(-3,16,0))
		sebastian.visual.walk(loc)
		while self.elapsed_time < 8000:
			yield
コード例 #4
0
def randomDirection():
    random_number = randrange(0, 5)
    if random_number == 0:
        return fife.ModelCoordinate(1, 0, 0)
    if random_number == 1:
        return fife.ModelCoordinate(-1, 0, 0)
    if random_number == 2:
        return fife.ModelCoordinate(0, 1, 0)
    else:
        return fife.ModelCoordinate(0, -1, 0)
コード例 #5
0
ファイル: cutscenes.py プロジェクト: Niektory/steamfolktales
	def cutsceneScript(self):
		gil = self.application.world.getCharacter("Gil")
		gil.teleport(fife.ModelCoordinate(-2,4,0), "Amelia_Engineroom")
		gil.use_combat_sprite = True
		yield
		loc = gil.visual.instance.getLocation()
		loc.setLayerCoordinates(fife.ModelCoordinate(-3,16,0))
		gil.visual.walk(loc)
		while self.elapsed_time < 4000:
			yield
コード例 #6
0
def startGarthDuel(cls, npc, pc, world):
    garth = world.getCharacter("Garth")
    if world.application.maplayer.getCellCache().getCell(
            fife.ModelCoordinate(1, 0, 0)).getCellType() > 1:
        garth.teleport(fife.ModelCoordinate(3, 2, 0))
    else:
        garth.teleport(fife.ModelCoordinate(1, 0, 0))
    world.application.startCombat([garth, pc])
    world.addMapTrigger("Uncle Garth defeated", "Sawmill_Hideout", None, None,
                        None, None, "prologue_jason_garth_defeated_dialogue",
                        True)
    world.knowledge["last_prologue"] = "Jason"
コード例 #7
0
ファイル: cutscenes.py プロジェクト: Niektory/steamfolktales
	def cutsceneScript(self):
		door_obj = self.application.world.getInteractObject("mansion2f_door1")
		door_obj.door.open(door_obj)
		sebastian = self.application.world.getCharacter("Sebastian")
		sebastian.teleport(fife.ModelCoordinate(-10,-12,0), "Mansion01_2ndfloor")
		yield
		loc = sebastian.visual.instance.getLocation()
		loc.setLayerCoordinates(fife.ModelCoordinate(-8,-14,0))
		sebastian.visual.walk(loc)
		while self.elapsed_time < 2500:
			yield
		sebastian.rotation = 45
コード例 #8
0
ファイル: cutscenes.py プロジェクト: Niektory/steamfolktales
	def cutsceneScript(self):
		gil = self.application.world.getCharacter("Gil")
		loc = gil.visual.instance.getLocation()
		loc.setLayerCoordinates(fife.ModelCoordinate(0,19,0))
		gil.visual.walk(loc)
		while self.elapsed_time < 1500:
			yield
		loc.setLayerCoordinates(fife.ModelCoordinate(1,19,0))
		gil.visual.attack(loc)
		while self.elapsed_time < 2500:
			yield
		gil.inventory.hands = []
コード例 #9
0
def startPrologueJasonSawmill(cls, npc, pc, world):
    young_jason = world.getCharacter("Young_Jason")
    young_jason.teleport(fife.ModelCoordinate(-68, -14, 0), "Ashgrove_Sawmill")
    young_jason.rotation = 0
    young_jason.sprite_override = None
    world.enablePlayerCharacter(young_jason)
    world.knowledge["jason_prologue"] = 2
    world.addMapTrigger("Young Jason entering the sawmill", "Ashgrove_Sawmill",
                        None, None, None, None,
                        "prologue_jason_sawmill_dialogue", True)
    garth = world.getCharacter("Garth")
    garth.teleport(fife.ModelCoordinate(2, 1, 0))
    garth.sprite_override = "sleep"
    garth.interact_script = "garthInteractScript"
コード例 #10
0
def _load(file, engine):
	if not db("ATTACH ? AS island", file).success:
		raise WrongFileType(file)

	map = _empty(engine)
	map.setResourceFile(file)
	layer = map.getLayer('ground')

	nr = 0
	already = []
	for (x, y, ground_id) in db("SELECT x, y, ground_id FROM island.ground"):
		if (int(x), int(y)) not in already:
			instance = layer.createInstance(engine.getModel().getObject(str(ground_id), 'ground'), fife.ModelCoordinate(int(x), int(y), 0), str(nr))
			location = fife.Location(layer)
			location.setLayerCoordinates(fife.ModelCoordinate(int(x + 1), int(y), 0))
			instance.setFacingLocation(location)
			fife.InstanceVisual.create(instance)
			instance.thisown = 0
			nr+=1
			already.append((int(x), int(y)))
	#except:
	#	raise WrongFileType(file)

	db("DETACH island")

	map.importDirs = []
	return map
コード例 #11
0
    def __init(self, x, y, owner, health=100.0):
        self.owner = owner

        class Tmp(fife.InstanceActionListener):
            pass

        self.InstanceActionListener = Tmp()
        self.InstanceActionListener.onInstanceActionFinished = \
          WeakMethod(self.onInstanceActionFinished)
        self.InstanceActionListener.thisown = 0  # fife will claim ownership of this
        if self._object is None:
            self.__class__._loadObject()

        self._instance = self.session.view.layers[LAYERS.OBJECTS].createInstance( \
         self._object, fife.ModelCoordinate(int(x), int(y), 0), str(self.worldid))
        fife.InstanceVisual.create(self._instance)
        location = fife.Location(self._instance.getLocation().getLayer())
        location.setExactLayerCoordinates(
            fife.ExactModelCoordinate(x + x, y + y, 0))
        self.act(self._action, location, True)
        self._instance.addActionListener(self.InstanceActionListener)

        self.health = health
        self.max_health = 100.0

        self.loading_area = self.position
コード例 #12
0
ファイル: girl.py プロジェクト: lynxis/fifengine
 def getNextWaypoint(self):
     self.waypoint_counter += 1
     l = fife.Location(self.layer)
     l.setLayerCoordinates(
         fife.ModelCoordinate(*self.waypoints[self.waypoint_counter %
                                              len(self.waypoints)]))
     return l
コード例 #13
0
    def __init(self, x, y, owner):
        self.owner = owner

        class Tmp(fife.InstanceActionListener):
            pass

        self.InstanceActionListener = Tmp()
        self.InstanceActionListener.onInstanceActionFinished = \
          WeakMethod(self.onInstanceActionFinished)
        self.InstanceActionListener.onInstanceActionFrame = lambda *args: None
        self.InstanceActionListener.thisown = 0  # fife will claim ownership of this

        self._instance = self.session.view.layers[
            LAYERS.OBJECTS].createInstance(
                self.__class__._fife_object,
                fife.ModelCoordinate(int(x), int(y), 0), str(self.worldid))
        fife.InstanceVisual.create(self._instance)
        location = fife.Location(self._instance.getLocation().getLayer())
        location.setExactLayerCoordinates(
            fife.ExactModelCoordinate(x + x, y + y, 0))
        self.act(self._action, location, True)
        self._instance.addActionListener(self.InstanceActionListener)

        self.loading_area = self.position

        self._health_displayed = False

        if self.has_component(HealthComponent):
            self.get_component(HealthComponent).add_damage_dealt_listener(
                self._on_damage)
コード例 #14
0
	def _update_buoy(self, remove_only=False):
		"""Draw a buoy at the move target if the ship is moving."""
		if self.owner is None or not self.owner.is_local_player:
			return
		move_target = self.get_move_target()

		ship_id = self.worldid
		session = self.session # this has to happen here,
		# cause a reference to self in a temporary function is implemented
		# as a hard reference, which causes a memory leak
		def tmp():
			session.view.renderer['GenericRenderer'].removeAll("buoy_" + str(ship_id))
		tmp() # also remove now

		if remove_only:
			return

		if move_target is not None:
			# set remove buoy callback
			self.add_move_callback(tmp)

			loc = fife.Location(self.session.view.layers[LAYERS.OBJECTS])
			loc.thisown = 0  # thisown = 0 because the genericrenderernode might delete it
			coords = fife.ModelCoordinate(move_target.x, move_target.y)
			coords.thisown = 1 # thisown = 1 because setLayerCoordinates will create a copy
			loc.setLayerCoordinates(coords)
			self.session.view.renderer['GenericRenderer'].addAnimation(
				"buoy_" + str(self.worldid), fife.RendererNode(loc),
				horizons.globals.fife.animationloader.loadResource("as_buoy0+idle+45")
			)
コード例 #15
0
	def move(self, dest):
		if isinstance(dest, fife.Location):
			location = dest
		elif isinstance(fife.ModelCoordinate(), fife.ModelCoordinate):
			location = self.instance.getLocation()
			location.setLayerCoordinates(dest)
		self.instance.move("walk", location, 3)
コード例 #16
0
 def _add_fake_tile(self, x, y, layer, renderer, color):
     """Adds a fake tile to the position. Requires 'self._fake_tile_obj' to be set."""
     inst = layer.createInstance(CombatManager._fake_range_tile_obj,
                                 fife.ModelCoordinate(x, y, 0), "")
     fife.InstanceVisual.create(inst)
     self._selected_fake_tiles.append(inst)
     renderer.addColored(inst, *color)
コード例 #17
0
def sebastianEntersCabins2(npc, pc, world):
    sebastian = world.getCharacter("Sebastian_Dustys")
    #sebastian.rotation = 270
    loc = sebastian.visual.instance.getLocation()
    loc.setLayerCoordinates(fife.ModelCoordinate(4, -19, 0))
    sebastian.visual.walk(loc)
    sebastian.dialogue = "prologue_dusty_sebastian_gun_dialogue"
コード例 #18
0
 def _add_fake_tile(cls, x, y, layer, renderer):
     """Adds a fake tile to the position. Requires 'cls._fake_tile_obj' to be set."""
     inst = layer.createInstance(SelectableBuildingComponent._fake_tile_obj,
                                 fife.ModelCoordinate(x, y, 0), "")
     fife.InstanceVisual.create(inst)
     cls._selected_fake_tiles.l.append(inst)
     renderer.addColored(inst, *cls.selection_color)
コード例 #19
0
def walk(entity, location):
    """Makes the entity walk to a certain location

    Args:
        entity: A :class:`fife_rpg.entities.rpg_entity.RPGEntity` with a
        fifeagent and a moving component

        location: A fife.Location or position tuple to walk to.
    """
    fifeagent_name = FifeAgent.registered_as
    moving_name = Moving.registered_as
    if fifeagent_name is None or moving_name is None:
        return
    fifeagent = getattr(entity, fifeagent_name)
    moving = getattr(entity, moving_name)
    if not fifeagent or not moving:
        return
    fifeagent.behaviour.state = AGENT_STATES.WALK
    fifeagent.behaviour.clear_actions()
    fifeagent.behaviour.callback = None
    if not isinstance(location, fife.Location):
        box_location = tuple([int(float(i)) for i in location])
        location = fife.Location(fifeagent.instance.getLocation())
        location.setLayerCoordinates(fife.ModelCoordinate(*box_location))
    fifeagent.instance.move(moving.walk_action, location, moving.walk_speed)
コード例 #20
0
ファイル: character.py プロジェクト: Niektory/steamfolktales
	def loadXML(cls, ID, filename, world):
		tree = ET.parse(filename)
		root = tree.getroot()
		if root.tag != "Character":
			return
		name = root.attrib["name"]
		sprite = root.attrib.get("sprite", "")
		map_name = root.attrib.get("map", "")
		x = root.attrib.get("x")
		y = root.attrib.get("y")
		if x is not None and y is not None:
			coords = fife.ModelCoordinate(int(x),int(y),0)
		else:
			coords = None
		character = cls(ID=ID, name=name, coords=coords, map_name=map_name, world=world,
						sprite=sprite)
		character.portrait = root.attrib.get("portrait", "")
		character.behavior = root.attrib.get("behavior", "").split(",")
		character.dialogue = root.attrib.get("dialogue")
		character.killable = root.attrib.get("killable") == "1"
		rotation = root.attrib.get("rotation")
		if rotation is not None:
			character.rotation = rotation
		character.interact_script = root.attrib.get("interact_script")
		for element in root:
			if element.tag == "Inventory":
				for slot_element in element:
					if slot_element.tag == "Hands":
						for item_element in slot_element:
							if item_element.tag == "Item":
								character.inventory.hands.append(
													loadItem(item_element.attrib["ID"]))
					elif slot_element.tag == "Head":
						for item_element in slot_element:
							if item_element.tag == "Item":
								character.inventory.head.append(
													loadItem(item_element.attrib["ID"]))
					elif slot_element.tag == "Body":
						for item_element in slot_element:
							if item_element.tag == "Item":
								character.inventory.body.append(
													loadItem(item_element.attrib["ID"]))
					elif slot_element.tag == "Backpack":
						for item_element in slot_element:
							if item_element.tag == "Item":
								character.inventory.addItem(item_element.attrib["ID"])
			elif element.tag == "Knowledge":
				character.knowledge[element.attrib["key"]] = element.attrib["value"]
			elif element.tag == "Stats":
				for stat_element in element:
					if stat_element.tag == "Attributes":
						for attr in character.rpg_stats.attribute_names:
							character.rpg_stats.attributes[attr] = int(stat_element.attrib[attr])
					elif stat_element.tag == "Skills":
						for skill_element in stat_element:
							if skill_element.tag == "Skill":
								character.rpg_stats.skills[skill_element.attrib["name"]] = \
														int(skill_element.attrib["rank"])
		return character
コード例 #21
0
    def loadMap(self, filename):
        """
		Simple function to load and display a map file. We could of course 
		have passed in the map filename but I'll leave that up to you.
		
		@param filename The filename.
		"""

        self._mapfilename = filename

        if self._loader.isLoadable(self._mapfilename):
            self._map = self._loader.load(self._mapfilename)
            self._mapLoaded = True

        self._camera = self._map.getCamera("camera1")
        self._actorlayer = self._map.getLayer("item_layer")
        self._groundlayer = self._map.getLayer("ground_layer")
        # sets ground static
        self._groundlayer.setStatic(True)
        self._player = self._actorlayer.getInstance("player")

        gridrenderer = self._camera.getRenderer('GridRenderer')
        gridrenderer.activateAllLayers(self._map)

        coordrenderer = fife.CoordinateRenderer.getInstance(self._camera)
        coordrenderer.setFont(self._font)
        coordrenderer.clearActiveLayers()
        coordrenderer.addActiveLayer(self._groundlayer)

        self.min = fife.ModelCoordinate()
        self.max = fife.ModelCoordinate()
        self._groundlayer.getMinMaxCoordinates(self.min, self.max)
        name = "skel"
        self.obj = self._player.getObject()
        # change pathfinder max ticks
        #pather = self.obj.getPather()
        #pather.setMaxTicks(1000)
        self._actionlistener = InstanceActionListener(self)
        for x in range(0, 1000):
            loc = self.createRandomTarget()
            i = self._actorlayer.createInstance(self.obj,
                                                loc.getLayerCoordinates(),
                                                name + str(x))
            fife.InstanceVisual.create(i)
            i.addActionListener(self._actionlistener)
            i.actOnce("stand", i.getFacingLocation())
コード例 #22
0
ファイル: guimaptest.py プロジェクト: Niektory/steamfolktales
 def load(self, args):
     item = self.file_list.getFirstSelectedItem()
     if item:
         self.application.prepareLoadMapTest(
             item.getText(),
             fife.ModelCoordinate(int(self.x_edit.getText()),
                                  int(self.y_edit.getText()), 0),
             self.sprite_edit.getText())
コード例 #23
0
    def createRandomTarget(self):
        x = random.randint(-13, 22)
        y = random.randint(-28, 13)
        mc = fife.ModelCoordinate(x, y)

        location = fife.Location(self._actorlayer)
        location.setLayerCoordinates(mc)
        return location
コード例 #24
0
def persistent_load(persid):
    if persid == "None":
        return None
    elif persid.startswith("ModelCoordinate "):
        return fife.ModelCoordinate(int(persid.split()[1]),
                                    int(persid.split()[2]),
                                    int(persid.split()[3]))
    else:
        raise pickle.UnpicklingError, "Invalid persistent id"
コード例 #25
0
	def loadXML(cls, ID, filename, world):
		tree = ET.parse(filename)
		root = tree.getroot()
		if root.tag != "InteractObject":
			return
		name = root.attrib["name"]
		sprite = root.attrib.get("sprite", "")
		map_name = root.attrib.get("map", "")
		x = root.attrib.get("x")
		y = root.attrib.get("y")
		if x is not None and y is not None:
			coords = fife.ModelCoordinate(int(x),int(y),0)
		else:
			coords = None
		interact_object = cls(ID=ID, name=name, coords=coords, map_name=map_name, world=world,
								sprite=sprite)
		interact_object.interact_script = root.attrib.get("interact_script")
		for element in root:
			if element.tag == "Inventory":
				interact_object.inventory = RPGInventory()
				for item_element in element:
					if item_element.tag == "Item":
						interact_object.inventory.addItem(item_element.attrib["ID"])
			elif element.tag == "Door":
				interact_object.door = Door(closed = element.attrib.get("closed") != "0")
			elif element.tag == "Portal":
				coords = fife.ModelCoordinate(
						int(element.attrib["x"]), int(element.attrib["y"]), 0)
				map_name = element.attrib.get("map")
				rotation = element.attrib.get("rotation")
				if rotation is not None:
					rotation = int(rotation)
				script = element.attrib.get("script")
				interact_object.portal = Portal(coords=coords, map_name=map_name,
												rotation=rotation, script=script)
			elif element.tag == "Lock":
				matching_key = element.attrib.get("matching_key")
				difficulty = int(element.attrib.get("difficulty", 0))
				locked = element.attrib.get("locked") != "0"
				interact_object.lock = Lock(matching_key=matching_key, difficulty=difficulty,
											locked=locked)
			else:
				print("Unknown tag:", element.tag)
		return interact_object
コード例 #26
0
ファイル: path.py プロジェクト: chembrad44/unknown-horizons
    def recalculate_orientation(self):
        """
		ROAD ORIENTATION CHEATSHEET
		===========================
		a       b
		 \  e  /     a,b,c,d are connections to nearby roads
		  \   /
		   \ /       e,f,g,h indicate whether this area occupies more space than
		 h  X  f     a single road would (i.e. whether we should fill this three-
		   / \       cornered space with graphics that will make it look like a
		  /   \      coherent square instead of many short-circuit road circles).
		 /  g  \     Note that 'e' can only be placed if both 'a' and 'b' exist.
		d       c

		SAMPLE ROADS
		============
		\     \     \..../  \    /    \    /
		 \    .\     \../    \  /.     \  /.
		  \   ..\     \/      \/..      \/..
		  /   ../     /         ..      /\..
		 /    ./     /           .     /..\.
		/     /     /                 /....\

		ad    adh   abde   abf (im-   abcdfg
		                   possible)
		"""
        action = ''
        origin = self.position.origin
        path_nodes = self.island.path_nodes

        for action_part, (xoff, yoff) in \
            sorted(BUILDINGS.ACTION.action_offset_dict.iteritems()): # order is important here
            tile = self.island.get_tile(origin.offset(xoff, yoff))
            if (tile is not None and tile.object is not None
                    and path_nodes.is_road(tile.x, tile.y)
                    and self.owner == tile.object.owner and
                (action_part in 'abcd' or
                 #HACK Check whether we can place valid road-filled areas
                 # Only adds 'g' to action if c and d are in already and the condition for g is met
                 (
                     action_part in 'efgh'
                     and chr(ord(action_part) - 4) in action
                     and chr(ord(action_part) - 3 - 4 *
                             (action_part == 'h')) in action
                     # 'h' has the parents a and d, so we hacked the hack
                 ))
                    # end #HACK
                ):
                action += action_part
        if action == '':
            action = 'single'  # single trail piece with no neighbors

        location = self._instance.getLocation()
        location.setLayerCoordinates(
            fife.ModelCoordinate(int(origin.x + 1), int(origin.y), 0))
        self.act(action, location, True)
コード例 #27
0
ファイル: bullet.py プロジェクト: xoedusk/unknown-horizons
	def __init__(self, image, source, dest, needed_ticks, session, offset=True, worldid=None):
		"""
		@param image: path to file with bullet image
		@param source: Point with starting position
		@param dest: Point with ending position
		@param speed: Attack speed of the Weapon that fires the canonball
		@param session: Horizons Session
		@param offset: True if image should be offseted from start location
		"""

		super(Bullet, self).__init__(worldid)
		self.session = session
		# get the current position
		self.x = source.x
		self.y = source.y

		# needed for saving the bullet
		self.dest_x = dest.x
		self.dest_y = dest.y
		self.image = image

		# offset the position so it starts from the middle of the firing instance
		if offset:
			self.x += 1
			self.y -= 1

		# needed ticks to go to the destination
		self.needed_ticks = needed_ticks
		self.needed_ticks -= 2

		# the thick that the object is currently at
		self.current_tick = 0

		# calculate the axis ratio that is added per tick to move
		self.x_ratio = float(dest.x - source.x)/self.needed_ticks
		self.y_ratio = float(dest.y - source.y)/self.needed_ticks

		if Bullet._fife_object is None:
			Bullet._fife_object = horizons.globals.fife.engine.getModel().createObject('cb', 'cannonball')
			fife.ObjectVisual.create(Bullet._fife_object)

			visual = self._fife_object.get2dGfxVisual()
			img = horizons.globals.fife.imagemanager.load(str(image))
			for rotation in [45, 135, 225, 315]:
				visual.addStaticImage(rotation, img.getHandle())


		self._instance = session.view.layers[LAYERS.FIELDS].createInstance(
			self._fife_object, fife.ModelCoordinate(int(self.x),int(self.y), 0), str(self.worldid))
		fife.InstanceVisual.create(self._instance)
		location = fife.Location(self._instance.getLocation().getLayer())
		location.setExactLayerCoordinates(fife.ExactModelCoordinate(self.x, self.y, 0))
		self.session.world.bullets.append(self)

		self._move_tick()
コード例 #28
0
	def moveInstant(self, dest):
		self.old_location = self.instance.getLocation()
		if isinstance(dest, fife.Location):
			location = dest
		elif isinstance(fife.ModelCoordinate(), fife.ModelCoordinate):
			location = self.instance.getLocation()
			location.setLayerCoordinates(dest)
		self.instance.setLocation(location)
		location.getLayer().getCellCache().getCell(self.old_location.getLayerCoordinates())\
				.removeInstance(self.instance) # the deadline is making me write this shit
		location.getLayer().getCellCache().getCell(location.getLayerCoordinates())\
				.addInstance(self.instance) # forgive me
コード例 #29
0
def initPrologue(cls, world):
    world.current_map_name = "TwoMapples_Inn"
    world.camera_coords = fife.ModelCoordinate(40, 0, 0)
    world.addMapTrigger("Two Mapples Inn intro", "TwoMapples_Inn", None, None,
                        None, None, "InnIntroCutscene", True)
    #world.addMapTrigger(
    #	"Two Mapples Inn prologue dialogue Radcliffe", "TwoMapples_Inn", None, None, None, None,
    #	lambda pc: cls.startDialogue(world, "prologue_dialogue0"), True)
    #world.addMapTrigger(
    #	"Two Mapples Inn Radcliffe walks to the bar", "TwoMapples_Inn", None, None, None, None,
    #	lambda pc: world.application.startCutscene(cls.InnIntroCutscene2), True)
    world.addMapTrigger("Two Mapples Inn prologue dialogue", "TwoMapples_Inn",
                        None, None, None, None, "prologue_dialogue", True)
コード例 #30
0
    def createRandomTarget(self):
        cache = self._actorlayer.getCellCache()
        while 1:
            x = random.randint(self.min.x, self.max.x)
            y = random.randint(self.min.y, self.max.y)
            mc = fife.ModelCoordinate(x, y)
            c = cache.getCell(mc)
            if c and c.getCellType() == fife.CTYPE_NO_BLOCKER:
                break

        location = fife.Location(self._actorlayer)
        location.setLayerCoordinates(mc)
        return location