示例#1
0
	def init_pickups(self, layer):
		# from archers.pickups import BronzeCoin, SilverCoin, GoldCoin
		for pickup in layer.all_objects():
			if(not 'respawn_time' in pickup.properties):
				pickup.properties['respawn_time'] = random.randint(30, 120)
			
			# try:
			classname = get_class('.'.join(['archers', 'pickups', pickup.type]))
			obj = classname(self, pickup)
			self.pickups_lookup[pickup] = {
				'pickup_id': self.get_object_id(obj),
				'step_placed': self.step,
				'step_destroyed': None
			}
示例#2
0
    def init_pickups(self, layer):
        # from archers.pickups import BronzeCoin, SilverCoin, GoldCoin
        for pickup in layer.all_objects():
            if (not 'respawn_time' in pickup.properties):
                pickup.properties['respawn_time'] = random.randint(30, 120)

            # try:
            classname = get_class('.'.join(['archers', 'pickups',
                                            pickup.type]))
            obj = classname(self, pickup)
            self.pickups_lookup[pickup] = {
                'pickup_id': self.get_object_id(obj),
                'step_placed': self.step,
                'step_destroyed': None
            }
示例#3
0
	def recreate_pickups(self, layer):
		for pickup in layer.all_objects():
			in_lookup = self.pickups_lookup[pickup]
			if(in_lookup):
				try:
					existing_pickup = self.get_object_by_id(in_lookup['pickup_id'])
				except KeyError:
					gone_seconds_ago = (self.step - in_lookup['step_destroyed'])/60.0
					if(gone_seconds_ago >= int(pickup.properties['respawn_time'])):
						
						#@TODO:Duplicate code above!
						classname = get_class('.'.join(['archers', 'pickups', pickup.type]))
						obj = classname(self, pickup)
						self.pickups_lookup[pickup] = {
							'pickup_id': self.get_object_id(obj),
							'step_placed': self.step,
							'step_destroyed': None
						}
示例#4
0
    def recreate_pickups(self, layer):
        for pickup in layer.all_objects():
            in_lookup = self.pickups_lookup[pickup]
            if (in_lookup):
                try:
                    existing_pickup = self.get_object_by_id(
                        in_lookup['pickup_id'])
                except KeyError:
                    gone_seconds_ago = (self.step -
                                        in_lookup['step_destroyed']) / 60.0
                    if (gone_seconds_ago >= int(
                            pickup.properties['respawn_time'])):

                        #@TODO:Duplicate code above!
                        classname = get_class('.'.join(
                            ['archers', 'pickups', pickup.type]))
                        obj = classname(self, pickup)
                        self.pickups_lookup[pickup] = {
                            'pickup_id': self.get_object_id(obj),
                            'step_placed': self.step,
                            'step_destroyed': None
                        }