当前位置: 首页>>代码示例>>Python>>正文


Python Object.__init__方法代码示例

本文整理汇总了Python中objects.Object.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Object.__init__方法的具体用法?Python Object.__init__怎么用?Python Object.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在objects.Object的用法示例。


在下文中一共展示了Object.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
 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,代码行数:9,代码来源:items.py

示例2: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
 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,代码行数:9,代码来源:functions.py

示例3: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
	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,代码行数:27,代码来源:Fleet.py

示例4: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
	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,代码行数:30,代码来源:Planet.py

示例5: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
    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,代码行数:33,代码来源:ships.py

示例6: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
 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,代码行数:27,代码来源:creatures.py

示例7: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
 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,代码行数:9,代码来源:gun.py

示例8: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
 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,代码行数:11,代码来源:animations.py

示例9: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
 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,代码行数:12,代码来源:missile.py

示例10: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
 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,代码行数:55,代码来源:spaceship.py

示例11: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
	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,代码行数:16,代码来源:player.py

示例12: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
	def __init__(self, sequence, \
			id, type, name, \
			size, \
			posx, posy, posz, \
			velx, vely, velz, \
			contains, \
			order_types, \
			order_number,
			modify_time):
		Object.__init__(self, sequence, \
			id, type, name, \
			size, \
			posx, posy, posz, \
			velx, vely, velz, \
			contains, \
			order_types, \
			order_number, \
			modify_time)
开发者ID:StupidIncarnate,项目名称:libtpproto-py,代码行数:20,代码来源:StarSystem.py

示例13: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
	def __init__(self, sequence, \
			id, type, name, \
			size, \
			startx, starty, startz, \
			velx, vely, velz, \
			contains, \
			order_types, \
			order_number, \
			modify_time, \
			endx, endy, endz):
		Object.__init__(self, sequence, \
			id, type, name, \
			size, \
			startx, starty, startz, \
			velx, vely, velz, \
			contains, \
			order_types, \
			order_number, \
			modify_time)

		self.length += 8*3
		self.start = self.pos
		self.end   = (endx, endy, endz)
开发者ID:StupidIncarnate,项目名称:libtpproto-py,代码行数:25,代码来源:Wormhole.py

示例14: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
    def __init__(self, model, shape, element):
        Object.__init__(self, model, shape, element)
	self.asteroid_type = None
	self.shot_tick_interval = 100
	self.shot_tick_counter = 0
	self.shot = False
开发者ID:giulianoxt,项目名称:pyasteroids,代码行数:8,代码来源:asteroid.py

示例15: __init__

# 需要导入模块: from objects import Object [as 别名]
# 或者: from objects.Object import __init__ [as 别名]
    def __init__(self, num):
        import proto_functions

        Object.__init__(self, prototype=proto_functions.num_proto)
        self.num = num
开发者ID:jnhnum1,项目名称:jang,代码行数:7,代码来源:numbers.py


注:本文中的objects.Object.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。