本文整理汇总了Python中enemy.Enemy.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Enemy.__init__方法的具体用法?Python Enemy.__init__怎么用?Python Enemy.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enemy.Enemy
的用法示例。
在下文中一共展示了Enemy.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, g, pos):
Enemy.__init__(self, g, pos, 'drop')
self.frm1 = g.images['inventory'][0].subsurface((0 * 32, 8 * 32, 32, 32))
self.frm2 = g.images['inventory'][0].subsurface((1 * 32, 8 * 32, 32, 32))
self.frm3 = g.images['inventory'][0].subsurface((2 * 32, 8 * 32, 32, 32))
self.frm4 = g.images['inventory'][0].subsurface((3 * 32, 8 * 32, 32, 32))
self.timer = random.randint(0, 50)
示例2: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, game, xStart = 0, yStart = 0, zStart = 0):
models = MODELS_PATH + "SwarmCraft"
anims = None
Enemy.__init__(self, models, anims, "**/enemyCollisionSphere", game, xStart, yStart, zStart)
self.maxSpeed = 5
self.randomMovementMax = random.randint(7 * 7, 10 * 7)
示例3: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, g, pos):
Enemy.__init__(self, g, pos, 'monster2')
hitSoundFile = os.path.join("effects", "critter4.wav")
self.birdhit = pygame.mixer.Sound(hitSoundFile)
self.health = 3
self.rect.height = 16
self.changedDirLastTick = 0
示例4: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, game, xStart = 0, yStart = 0, zStart = 0):
models = MODELS_PATH + "TankyHovercraft"
anims = None
Enemy.__init__(self, models, anims, "**/enemyCollisionSphere", game, xStart, yStart, zStart)
self.cooldownLength = random.randint(6, 8)
self.cooldownLeft = self.cooldownLength
self.preferedDistanceFromPlayer = random.randint(20, 40)
self.clockwise = random.choice((True, False))
示例5: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, game, player, xStart = 0, yStart = 0, zStart = 0):
models = MODELS_PATH + "HovercraftOne"
anims = None
Enemy.__init__(self, models, anims, "**/enemyCollisionSphere", game, xStart, yStart, zStart)
self.health = 10
self.pointValue = 1
self.player = player
示例6: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, g, pos):
Enemy.__init__(self, g, pos, "nurse")
hitSoundFile = os.path.join("effects", "critter6.wav")
self.birdhit = pygame.mixer.Sound(hitSoundFile)
self.health = 2
self.speed = 4
self.direction = random.randint(0, 2) % 2
self.mode = "walking"
self.changedDirLastTick = 0
示例7: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, g, pos):
Enemy.__init__(self, g, pos, 'bugs')
self.frm1 = g.images['inventory'][0].subsurface((7 * 32, 7 * 32, 32, 32))
self.frm2 = g.images['inventory'][0].subsurface((6 * 32, 7 * 32, 32, 32))
self.rect.y += 2
self.rect.x += random.randint(-4,4)
self.flying = 0
self.vecx = random.randint(-5,5)
self.vecy = 0
示例8: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, g, pos):
Enemy.__init__(self, g, pos, 'monster1')
hitSoundFile = os.path.join("effects", "critter4.wav")
self.birdhit = pygame.mixer.Sound(hitSoundFile)
self.health = 20
self.rect.height = 64
self.waketype = 'near' # either near or water
self.wet = 0
self.squirt2 = pygame.mixer.Sound(os.path.join("effects", "squirt2.wav"))
示例9: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, x, y, direction=c.DIR_RIGHT):
Enemy.__init__(self, x, y, c.SCORE_GOOMBA, direction)
self.goomba_frames = []
self.dead_frame = None
self.x_vel = 2
self.init_frames()
self.refresh_image(self.goomba_frames[0])
示例10: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, image, x, y, direction = RIGHT, topSpeed = 5, health = 50):
"""
initialize stuff
"""
Enemy.__init__(self, image, x, y, direction, topSpeed, health)
self.originalTopSpeed = topSpeed
self.lastTurbo = 0
self.currentTurbo = 0
self.turboDelay = 3000
self.turboTime = 700
示例11: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, width, height, x, y):
Enemy.__init__(self, width, 20, x, y)
self.dir = 'D'
self.speed = 1
# initialize sprite lists
ss = SpriteSheet(path.join(get_art_dir(), 'Spider', 'Spider_spritesheet.png'), 4)
self.sprites_walk_left = ss.get_sprites(size=(30, 20))
self.sprites_walk_right = [pygame.transform.flip(s, True, False) for s in self.sprites_walk_left]
self.image = self.sprites_walk_left[0]
示例12: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, x, y, shell_group, direction=c.DIR_LEFT):
Enemy.__init__(self, x, y, c.SCORE_KOOPA, direction)
self.shell_group = shell_group
self.koopa_frames = []
self.x_vel = 1.5
self.init_frames()
self.refresh_image(self.koopa_frames[0])
示例13: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, x, y):
Enemy.__init__(self, x, y, Sprite("gullug"))
self.set_animation_state(first=0, last=2, delay=6, loop=True)
self.ticks = 0
self.hp = 24
self.hurtable = True
self.radius = 50 # how large a circle from his origin he flies in
self.speed = 1.5 # how fast he flies his circular path
self.ox = self.x # origin point x
self.oy = self.y # origin point y
示例14: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, g, pos):
Enemy.__init__(self, g, pos, 'monster5')
hitSoundFile = os.path.join("effects", "critter7.wav")
self.birdhit = pygame.mixer.Sound(hitSoundFile)
self.health = 8
self.speed = 3
self.direction = random.randint(0, 2) % 2
self.mode = 'idle'
self.jumpvel = 0.0
self.jumpstart = 8.0
示例15: __init__
# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import __init__ [as 别名]
def __init__(self, startingpos=[0, 0]):
Enemy.__init__(self)
image_path = os.path.join(os.path.realpath('.'), 'Images', 'jelly.gif')
self.image = pygame.image.load(image_path).convert()
self.rect = self.image.get_rect()
self.rect.left += startingpos[0]
self.rect.top += startingpos[1]
self.speed = [1, 1]
self.health = 100
self.hitbox = self.rect