當前位置: 首頁>>代碼示例>>Python>>正文


Python objects.Object類代碼示例

本文整理匯總了Python中objects.Object的典型用法代碼示例。如果您正苦於以下問題:Python Object類的具體用法?Python Object怎麽用?Python Object使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Object類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

	def __init__(self, sequence, \
			id, type, name, \
			size, \
			posx, posy, posz, \
			velx, vely, velz, \
			contains, \
			order_types, \
			order_number, \
			modify_time, \
			owner, resources):
		Object.__init__(self, sequence, \
			id, type, name, \
			size, \
			posx, posy, posz, \
			velx, vely, velz, \
			contains, \
			order_types, \
			order_number, \
			modify_time)

		self.length += 4 + 4 + 16 * len(resources)
		self.owner = owner

		for r in resources:
			if len(r) != 4:
				raise TypeError("Resources should be 4 length, <id> <surface> <minable> <inaccess>")

		self.resources = resources
開發者ID:StupidIncarnate,項目名稱:libtpproto-py,代碼行數:28,代碼來源:Planet.py

示例2: __init__

 def __init__(self, model, shape, element, lvl, duration, damage):
     Object.__init__(self, model, shape, element)
     
     self.duration = duration
     self.elapsed = 0.0
     self.lvl = lvl
     self.damage = damage
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:7,代碼來源:gun.py

示例3: __init__

    def __init__( self, stats, ai, xp, yp, zp=0, ori=0.0, xi=0, yi=0, zi=0, ri=0, thrust=0 ):
        Object.__init__( self, stats, xp, yp, zp, ori, xi, yi, zi, ri )

        self.alive = True
        self.maxOri = 2*pi

        self.thrust = thrust
        self.rg = 0

        self.shieldVsMass = self.stats.shieldVsMass
        self.shieldVsEnergy = self.stats.shieldVsEnergy
        self.hullVsMass = self.stats.hullVsMass 
        self.hullVsEnergy = self.stats.hullVsEnergy

        self.ai = ai
        self.dockedTo = False
        self.dockedAt = 0 # tick at docking

        self.hull = stats.maxHull
        self.shield = stats.maxShield
        self.inertiaControl = True

        self.headed = True # differentiate bases from ships

        self.pulsedUntil = -1000
        self.inNebula = False # variable state
        self.inertiaMod = 1
        self.thrustBoost = 0

        self.shipyards = [] # list of regulard shipyards
        self.guestDocked = [] # list of temporary docks
開發者ID:xymus,項目名稱:pycaptain,代碼行數:31,代碼來源:ships.py

示例4: __init__

 def __init__(self, x, y, char, name, color, slot, power_bonus=0, defense_bonus=0, max_hp_bonus=0):
     Object.__init__(self, x, y, char, name, color, blocks=False, always_visible=False)        
     self.slot = slot
     self.is_equipped = False
     self.power_bonus = power_bonus
     self.defense_bonus = defense_bonus
     self.max_hp_bonus = max_hp_bonus
開發者ID:splaroche,項目名稱:Roguelike,代碼行數:7,代碼來源:items.py

示例5: __init__

 def __init__(self, parent_context, param_list, statements):
     import proto_functions
     Object.__init__(self, prototype=proto_functions.function_proto)
     self.parent_context = parent_context
     self.param_list = param_list
     self.statements = statements
     self.constructing_prototype = Object()
開發者ID:jnhnum1,項目名稱:jang,代碼行數:7,代碼來源:functions.py

示例6: __init__

 def __init__(self, x, y, char, name, color, blocks=True, ai=None, always_visible=False,
              equipment=None, character_class=None, creature_type=None, xp=0, screen=None):
     #call super constructor to create the map object
     Object.__init__(self, x, y, char, name, color, blocks=blocks, always_visible=always_visible)
     self.character_class = character_class
     if self.character_class:
         # let the fighter component know who owns it
         self.character_class.owner = self
     
     self.screen = screen
     if self.screen:
         # set the screen element in the character_class
         self.character_class.screen = screen        
     
     self.ai = ai
     if self.ai:
         # let the ai component know who owns it
         self.ai.owner = self        
     
     self.xp = xp            
     self.dead = False
     self.inventory = []        
     #set the default equipment dictionary.
     self.equipment = {'head': None, 'body':None, 'legs':None, 'hands':None, 'feet':None, 'left hand': None, 'right hand': None}
     self.player = None
開發者ID:splaroche,項目名稱:Roguelike,代碼行數:25,代碼來源:creatures.py

示例7: __init__

	def __init__(self, sequence, \
			id, type, name, \
			size, \
			posx, posy, posz, \
			velx, vely, velz, \
			contains, \
			order_types, \
			order_number, \
			modify_time, \
			owner, ships, damage):
		Object.__init__(self, sequence, \
			id, type, name, \
			size, \
			posx, posy, posz, \
			velx, vely, velz, \
			contains, \
			order_types, \
			order_number, \
			modify_time)

		self.length += 4 + 4 + len(ships) * 8 + 4

		self.owner = owner
		self.ships = ships
		self.damage = damage
開發者ID:StupidIncarnate,項目名稱:libtpproto-py,代碼行數:25,代碼來源:Fleet.py

示例8: tick

 def tick(self, time_elapsed):
     Object.tick(self, time_elapsed)
     
     self.elapsed += time_elapsed
     
     if (self.elapsed >= self.duration):
         self.lvl.remove_object(self)
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:7,代碼來源:gun.py

示例9: __init__

 def __init__(self, position):
     Object.__init__(self)
     self.frame = 0
     self._position = position
     self.frames = self._cls_frames[:]
     self.frames_count = len(self.frames)
     self._current_frame_time = 0
     self._finished = False
     self.load_frame()
開發者ID:ironsmile,項目名稱:tank4eta,代碼行數:9,代碼來源:animations.py

示例10: __init__

 def __init__(self, model, shape, element, lvl, damage, target_obj, attract_v):
     Object.__init__(self, model, shape, element)
     
     self.lvl = lvl
     self.damage = damage
     self.target = target_obj
     
     self.velocity = attract_v
     
     self.dir = Vector3d(0.,0.,0.)
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:10,代碼來源:missile.py

示例11: tick

 def tick(self, time_elapsed):
     if (hasattr(self.target, 'destroyed') and self.target.destroyed):
         self.lvl.remove_object(self)
         return
     
     self.dir = (self.target.shape.position - self.shape.position).normalizing()
     
     v = self.dir.scalar(self.velocity)
     
     self.shape.velocity = v
     
     Object.tick(self, time_elapsed)
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:12,代碼來源:missile.py

示例12: tick

 def tick(self, time_elapsed):       
     Object.tick(self, time_elapsed)
             
     self.update_mouse_track(time_elapsed)
     self.update_spinning(time_elapsed)
     self.update_strafe(time_elapsed)
     
     self.simple_gun.tick(time_elapsed)
     self.simple_missile.tick(time_elapsed)
     
     self.collision_set = self.keep_colliding
     self.keep_colliding = set()
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:12,代碼來源:spaceship.py

示例13: __init__

 def __init__(self, model, shape, element, level):
     Object.__init__(self, model, shape, element)
     
     cfg = Config('physics','Ship')
     
     self.move_force_sz = cfg.get('move_force')
     self.spin_velocity = cfg.get('spin_velocity')
     self.strafe_force = cfg.get('strafe_force')
     self.shape.forces_res.append(cfg.get('vacuum_resistance'))
     self.breake_rate = cfg.get('breake_rate')
     
     self.mouse_sensivity = Config('game','Mouse').get('sensivity')
     
     self.level = level
     
     self.rotation = Quaternion.from_axis_rotations(0.,0.,0.)
     
     self.ship_dir = None
     self.up_dir = None
     
     self.spinning = {
         'up'    : False,
         'down'  : False,
         'left'  : False,
         'right' : False
     }
             
     self.vectors = {
         'up'    : (Vector3d.x_axis(), 1.),
         'down'  : (Vector3d.x_axis(), -1.),
         'left'  : (Vector3d.y_axis(), 1.),
         'right' : (Vector3d.y_axis(), -1.)
     }
     
     self.strafe = {
         'forward': False,
         'left'  : False,
         'right' : False,
         'breake' : False
     }
     
     self.strafe_vectors = {
         'forward':Vector3d(0.,0.,-0.7),
         'left'  : Vector3d(-0.9,0.,0.),
         'right' : Vector3d(0.9,0.,0.),
         'breake' : Vector3d(0.,0.,1.)
     }
     
     self.angles = [0.,0.]
     self.mouse_target = [0.,0.]
     
     self.collision_set = set()
     self.keep_colliding = set()
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:53,代碼來源:spaceship.py

示例14: __init__

	def __init__(self, map, con, x,y, char, color, fighter=None, level=None):
		Object.__init__(self, None, con, x,y, char,
			libtcod.namegen_generate('Celtic male'), color, True, fighter=fighter, level=level
		)

		map.player = self
		self.inventory = Inventory()
		self.mods = Inventory()

		class Item:
			stack_limit = 5
		obj = Object(None, con, None,None, 'b', 'boost', color, item=Item())
		obj.mod = mods.Boost()
		self.mods.add_item(obj)
開發者ID:fiddlerwoaroof,項目名稱:yinjar,代碼行數:14,代碼來源:player.py

示例15: _create

 def _create(cls, repo, path, resolve, reference, force):
     """internal method used to create a new symbolic reference.
     If resolve is False,, the reference will be taken as is, creating 
     a proper symbolic reference. Otherwise it will be resolved to the 
     corresponding object and a detached symbolic reference will be created
     instead"""
     full_ref_path = cls.to_full_path(path)
     abs_ref_path = os.path.join(repo.git_dir, full_ref_path)
     
     # figure out target data
     target = reference
     if resolve:
         target = Object.new(repo, reference)
         
     if not force and os.path.isfile(abs_ref_path):
         target_data = str(target)
         if isinstance(target, SymbolicReference):
             target_data = target.path
         if not resolve:
             target_data = "ref: " + target_data
         if open(abs_ref_path, 'rb').read().strip() != target_data:
             raise OSError("Reference at %s does already exist" % full_ref_path)
     # END no force handling
     
     ref = cls(repo, full_ref_path)
     ref.reference = target
     return ref
開發者ID:asavonic,項目名稱:moldynam,代碼行數:27,代碼來源:refs.py


注:本文中的objects.Object類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。