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


Python Entity.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
 def __init__(self, x, y):
     Entity.__init__(self)
     self.image = pygame.image.load("files/Platforms/Bad_Platform.png")
     self.image = pygame.transform.scale(self.image, (128, 32))
     self.image.convert()
    
     self.rect = Rect(x, y+10, 128, 32)  #Платформата се извежда "вкопана"
开发者ID:Plamen1466,项目名称:Robopartans_The_Game,代码行数:9,代码来源:BadPlatform.py

示例2: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
    def __init__(self, x, y, imageName=None, colorkey=None, coordsName=None, numImages=None, magicNumbers=(0, 0, 0, 0, 0, 0, 0, 0), director=None, *args):
        Entity.__init__(self, x, y, imageName, colorkey, coordsName, numImages)
        self.director = None
        self.speedX = 0
        self.speedY = 0
        self.controller = None
        self.equippedWpn = None
        self.attacking = False
        self.atk_delay_reset = 1.0 # Character dependent delay time
        self.atk_delay = self.atk_delay_reset  # Starts with cooldown. Trust me, it's better.
        self.hp = 40
        self.atk = 10

        # To what point is the character trying to attack? Useful for ranged
        # weapons.
        self.atkX = 0
        self.atkY = 0

        self.just_attacked = False

        if not imageName:
            self.rect = pygame.Rect(x, y, 15, 25)

        # Needed for a better weapon placement
        self.magicNumbers = magicNumbers
        self.atk_speed = PLAYER_ATTACK_SPEED
开发者ID:hmourit,项目名称:Aleph,代码行数:28,代码来源:Character.py

示例3: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
    def __init__(self, a):
        Entity.__init__(self, a)
        self.name = 'MouseEntity'
        self.mouse_pos = Vect2([0.0, 0.0])
        self.origImage = pygame.image.load('data/mousePlayer.png')
        self.image =  self.origImage
        self.imgState = 0
        self.image1 = pygame.image.load('data/mousePlayer_1.png')
        self.image2 = pygame.image.load('data/mousePlayer_2.png')
        self.image3 = pygame.image.load('data/mousePlayer_3.png')
        self.grabsound = pygame.mixer.Sound('data/grab.wav')
        self.dropsound = pygame.mixer.Sound('data/drop.wav')

        self.image = self.origImage
        self.radius = self.image.get_rect().width/2
        print self.radius
        self.rotate = 0

        self.radius = float(self.image.get_width()) / 2.0

        self.maxSpeed = 100
        
        self.grabbing = False
        self.grabDist = 60 # pixel distance within which you can grab something
        self.grabbedEntity = None
开发者ID:bpeck,项目名称:ProjectFuschiaFairy,代码行数:27,代码来源:MouseEntity.py

示例4: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
 def __init__(self, id, name, numberOfUnits=1, parentBatch=None, parentBatchName=None, parentBatchId=None,
              remainingProcessingTime=0, currentStation=None, unitsToProcess=0,receiver=None,**kw):
     Entity.__init__(self, name=name, id=id, remainingProcessingTime=remainingProcessingTime,
                     currentStation=currentStation)
     self.numberOfUnits=int(numberOfUnits)
     self.parentBatch=parentBatch
     self.unitsToProcess=int(float(unitsToProcess))
     # if the parent batch was not given find it or create it
     if not self.parentBatch:
         # check if the parent batch is already created. If not, then create it
         batch=None
         from Batch import Batch
         from Globals import G
         for b in G.EntityList:
             if b.id==parentBatchId:
                 batch=b
         if batch:               #if the parent batch was found add the number of units of current sub-batch
             batch.numberOfUnits+=self.numberOfUnits
         else:     #if the parent batch was not found create it
             batch=Batch(parentBatchId,parentBatchName,numberOfUnits)
             G.EntityList.append(batch)
         self.parentBatch=batch
     self.batchId=self.parentBatch.id
     import Globals
     self.receiver=Globals.findObjectById(receiver)
     self.parentBatch.subBatchList.append(self)
开发者ID:Kodextor,项目名称:dream,代码行数:28,代码来源:SubBatch.py

示例5: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
 def __init__(self, x, y, image_path):
     Entity.__init__(self)
     self.image = pygame.image.load(image_path+"/plate.png")
     self.image = pygame.transform.scale(self.image, (32, 32))
     self.image.convert()
    
     self.rect = Rect(x, y, 32, 32)
开发者ID:Plamen1466,项目名称:Robopartans_The_Game,代码行数:9,代码来源:ScoreLine.py

示例6: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
 def __init__(self, id):
     """
     Arguments:
     o id - int
     """
     self.level="M"
     Entity.__init__(self, id)
开发者ID:GunioRobot,项目名称:biopython,代码行数:9,代码来源:Model.py

示例7: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
 def __init__(self):
     Entity.__init__(self)
     self.type = 0
     self.rage = False
     self.health = 1
     self.dead = False
     self.facingRight = True
开发者ID:CHAZICLE,项目名称:supercram,代码行数:9,代码来源:Enemy.py

示例8: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
 def __init__(self):
   Entity.__init__(self)
   self.lastfm = pylast.LastFMNetwork(api_key=params.LASTFM_API_KEY,
                   api_secret=params.LASTFM_API_SECRET,
                   username=USERNAME,
                   password_hash=pylast.md5(PASSWORD))
   config.ECHO_NEST_API_KEY = params.ECHONEST_API_KEY
开发者ID:Sushant,项目名称:quest,代码行数:9,代码来源:Artist.py

示例9: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
	def __init__(self, x, y, image_path):
		Entity.__init__(self)
		self.image = pygame.image.load(image_path+"/ground.png")
		self.image = pygame.transform.scale(self.image, (64*6, 64))
		self.image.convert()

		self.rect = Rect(x, y, 64*6, 64)
开发者ID:Plamen1466,项目名称:Robopartans_The_Game,代码行数:9,代码来源:Ground.py

示例10: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
    def __init__(self, pos, radius, numVertices):
        Entity.__init__(self, radius, pos)
        if numVertices < 3:
            numVertices = 3

        self.numVertices = numVertices
        self.verts = [(0,0)]*numVertices
        self.recalcVerts()
开发者ID:jl111,项目名称:Hack_2015,代码行数:10,代码来源:Asteroid.py

示例11: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
	def __init__(self, x, y):
		Entity.__init__(self, x, y, "explosion.png", -1, "coordExplosion.txt", [25])
		self.rect.centerx = x + 2
		self.rect.bottom = y + 12

		sound = load_sound("explosion.wav")
		sound.set_volume(0.25)
		sound.play()
开发者ID:dgalaktionov,项目名称:Aleph,代码行数:10,代码来源:Explosion.py

示例12: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
 def __init__(self, id, name, numberOfUnits=1, currentStation=None, 
              remainingProcessingTime=0, unitsToProcess=0, **kw):
     Entity.__init__(self, name=name, id=id, remainingProcessingTime=remainingProcessingTime,
                     currentStation=currentStation)
     self.numberOfUnits=int(numberOfUnits)
     self.numberOfSubBatches=1       #integer that shows in how many sub batches is the batch broken
     self.subBatchList=[]            #list that contains the sub-batches that this batch has been broken into
     self.unitsToProcess=int(float(unitsToProcess))
开发者ID:Kodextor,项目名称:dream,代码行数:10,代码来源:Batch.py

示例13: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
    def __init__(self, id=None, name=None):
        Entity.__init__(self,id=id,name = name)

        self.Res=Resource(self.capacity)
        #dimension data
        self.width=2.0
        self.height=2.0
        self.lenght=2.0        
开发者ID:mmariani,项目名称:dream,代码行数:10,代码来源:Frame.py

示例14: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
 def __init__(self):
     Entity.__init__(self)
     self.weapon = Pistol()
     self.playerCharacter = 0
     self.onGround = True
     self.facingRight = True
     self.jumping= False
     self.jumpStart = 0
     self.keysDown = []
开发者ID:SuperCram,项目名称:supercram,代码行数:11,代码来源:Player.py

示例15: __init__

# 需要导入模块: from Entity import Entity [as 别名]
# 或者: from Entity.Entity import __init__ [as 别名]
 def __init__(self, id=None, name=None, capacityProjectId=None, requiredCapacity=10, priority=0, dueDate=0,
               orderDate=0, currentStation=None, isCritical=False, **kw):
     Entity.__init__(self, id, name, priority, dueDate, orderDate, isCritical, currentStation=currentStation)
     self.capacityProjectId=capacityProjectId    # the project id hat the capacity Entity is part of
     self.capacityProject=None                   # the project that the capacity Entity is part of. It is defined in initialize
     self.requiredCapacity=requiredCapacity  # the capacity that the capacity entity requires from the following station
     self.shouldMove=False
     from Globals import G
     G.CapacityEntityList.append(self)  
开发者ID:Kodextor,项目名称:dream,代码行数:11,代码来源:CapacityEntity.py


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