本文整理汇总了Python中Entity.Entity类的典型用法代码示例。如果您正苦于以下问题:Python Entity类的具体用法?Python Entity怎么用?Python Entity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Entity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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) #Платформата се извежда "вкопана"
示例2: update
def update(self,t=0):
Entity.update(self,t)
#print t, self.rect.topleft, self._speed
if self.jumping:
# if the jumping flag is true,
# call the jump function
self.setSpeed('x',-14.0)
self.jumping = False
else:
self.setSpeed('x',self._speed[1]+t/50.0)
if self.rect.top >= 230: # if you hit the top, reset the vel so it
self.setSpeed('x',0.0) # doesn't get stuck up at the top
# limit duration of post damage invincibility (2500 ms)
if self._invincible_time > 0:
self._invincible_time -= t
# On average, turn invisible for every other frame
if ((self._invincible_time /100)%2) == 0:
self.image = self._invisible_pic
else:
self.image = self._images[0]
if self.rect.left < 0:
self.rect.left = 0
elif self.rect.right > 930:
self.rect.right = 930
示例3: __init__
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)
示例4: __init__
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)
示例5: __init__
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
示例6: entity_data
def entity_data(request):
""" """
site = request.matchdict['code']
claims, site = verify_access(request, site=site)
e = Entity(request)
summnote, fullnote = e.data()
return { 'summnote': summnote, 'fullnote': fullnote }
示例7: __init__
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
示例8: update
def update(*args):
self = args[0]
width = args[1]
height = args[2]
Entity.update(self, width, height)
self.animate()
self.changed = False
示例9: __init__
def __init__(self):
Entity.__init__(self)
self.type = 0
self.rage = False
self.health = 1
self.dead = False
self.facingRight = True
示例10: __init__
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
示例11: update
def update(self,t=0):
Entity.update(self,t)
#print t, self.rect.topleft, self._speed
if self.jumping:
# if the jumping flag is true,
# call the jump function
self.setSpeed('x',-14.0)
self.jumping = False
else:
self.can_jump = True
self.setSpeed('x',self._speed[1]+t/50.0)
if self.rect.top >= 230:
self.setSpeed('x',0.0)
# limit duration of post damage invincibility (2500 ms)
if self._invincible == True:
if self._invincible_time < 2500:
self._invincible_time += t
if ((self._invincible_time /100)%2) == 0:
self.image = self._invisible_pic
else:
self.image = self._images[0]
else:
self._invincible = False
self._invincible_time = 0
示例12: __init__
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)
示例13: _Render
def _Render(self, renderWindow, windowView):
"""Here we render the contained entities onto the screen. (This happens once per program loop!)"""
Entity._Render(self, renderWindow, windowView)
for indx in xrange(len(self._pqEntities)):
self._pqEntities[indx]._Render(renderWindow, windowView)
示例14: __init__
def __init__(self, id):
"""
Arguments:
o id - int
"""
self.level="M"
Entity.__init__(self, id)
示例15: __init__
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