def __init__(self, x, y, ai, level=None): #general stuff self.isFlying = False #is the player flying? self.facingRight = False #player facing right? self.peaking = False #is player at the peak of its jump? self.canMove = False self.canJump = False self.player = None self.ai = ai #shooting timer self.sattack_timer = 0 #level instance - pass if enemy interacts with level self.level = level #choose AI to implement self.AI_implementations = { NONE: self.AI_nothing, FLOOR: self.AI_floor, PLATFORM: self.AI_platform, JUMP: self.AI_jump, HOP: self.AI_hop, FLYVERT: self.AI_flyvert, FLYHORIZ: self.AI_flyhoriz, FLYSWOOP: self.AI_flyswoop, FLYATTACK: self.AI_flyattack, RPROJ: self.AI_rproj, RPROJSTAND: self.AI_rprojstand, SHY: self.AI_shy, CUSTOM: None} Character.__init__(self,x,y)
def __init__(self, x, imgFile="npc_sprite.png"): Character.__init__(self, imgFile) self.images = [] # 0=idle, 1=running#1 , 2=running#2 for i in range(3): image = pygame.Surface([100, 200], pygame.SRCALPHA, 32).convert_alpha() image.blit(self.image, (0, 0), (i*100, 0, 100, 200)) self.images.append(image) self.images.append(pygame.transform.flip(self.images[0], True, False)) self.images.append(pygame.transform.flip(self.images[1], True, False)) self.images.append(pygame.transform.flip(self.images[2], True, False)) self.rect = self.images[0].get_rect() self.rect.x = x self.home = x self.rect.y = screen_h - 150 self.time = pygame.time.get_ticks() self.state = "idle" # idle/moving idle == maksmata self.idle_job = [0, 0] # [job, time when to stop] jobs: 0=right, 1=left, 2=wait self.x_speed = 0 self.move_to = self.home self.frame_counter = 0
def __init__(self, scene): size = (16,16) color = (255,0,0) name = "Player 1" speed = 2 hp = 20 Character.__init__(self, scene, size, color, name, speed, hp)
def __init__(self): Character.__init__(self) self.state = 'normal' self.health = 10 self.wealth = 1 self.health_max = 10
def __init__(self, x, y, ai, level=None): #general stuff self.isFlying = False #is the player flying? self.facingRight = False #player facing right? self.peaking = False #is player at the peak of its jump? self.canMove = False self.canJump = False self.player = None self.ai = ai #shooting timer self.sattack_timer = 0 #level instance - pass if enemy interacts with level self.level = level #choose AI to implement self.AI_implementations = { NONE: self.AI_nothing, FLOOR: self.AI_floor, PLATFORM: self.AI_platform, JUMP: self.AI_jump, HOP: self.AI_hop, FLYVERT: self.AI_flyvert, FLYHORIZ: self.AI_flyhoriz, FLYSWOOP: self.AI_flyswoop, FLYATTACK: self.AI_flyattack, RPROJ: self.AI_rproj, RPROJSTAND: self.AI_rprojstand, SHY: self.AI_shy, CUSTOM: None } Character.__init__(self, x, y)
def __init__(self): Character.__init__(self) self.lives = 10 self.__coordinates = {} self.__display = [] self.__centre = 18 self.__ice_ball_number = 0 for i in range(13, 24): self.__coordinates[i] = [] for j in range(columns - 38, columns - 5): self.__coordinates[i].append(j) with open('boss.txt', 'r') as f: pic = f.readlines() for i in pic: self.__display.append(list(i)) # print(len(list(i))) self.__game_over_display = [] with open('win.txt', 'r') as f: pic = f.readlines() for i in pic: # print(i) self.__game_over_display.append(list(i))
def __init__(self, identifier, image, name, max_health, defense, accuracy, agility, attack, speed, is_dead, position, item, starting_xp, death_xp): Character.__init__(self, identifier, image, name, max_health, defense, accuracy, agility, attack, speed, is_dead, position, item, starting_xp, death_xp) pygame.sprite.Sprite.__init__(self)
def __init__(self, name, health, strength, weapon, armor): Character.__init__(self) self.name = name self.health = health self.strength = strength self.weapon = weapon self.armor = armor
def __init__(self): Character.__init__(self) Keylistener.__init__(self) #TODO: These values are just for testing. self.rect.x = 320 self.rect.y = 320 # self.walk_speed = 256; self.key_inputs = {'up': False, 'right': False, 'down': False, 'left': False, 'atk': False} self.knife = weapons.Knife() self.lock_face = False self.swinging = False self.holding = False self.invulnerable = False self.anim_timer = 0 self.hit_invuln_duration = 1024 self.invuln_flash_frequency = 32 self.take_damage_listeners = []
def __init__(self, i, j, name, floor): Character.__init__(self, i, j, name, floor) values = ele_lib.LIB[name] self._attack = values.attack self._defense = values.defense self._hp = values.hp self._gold = values.gold
def __init__(self, world_map, path, shoottime): Character.__init__(self, world_map, world_map.group, world_map.enemies_group) self.path = path self.x = 0 self.y = 0 self.shoottime = shoottime self.frame_counter = 0
def __init__(self,lives=None): Character.__init__(self,'Din',lives) self.__shield_active = 1 self.__shield_tl = 2 # Shield time left after shield started self.__shield_ta = 0 # Time since spawn/last time shield used if shield_ta> # Sprite details self.__sprite = ["","","","",""] self.__sprite[0] = ' T"-.,_ \n l: ~{--._ \n I: .` "c \n .--. l /.-~"-. | \nY /~("-, I___ )Y .--r_Y | \n\\_ "./~_~]__=~"j \\__L__[| \n \\~" \\T T.__~<--r.__./ |___ \n {--}]_L_,.) )( ( /\\___lc--\' \n Y /~("___\\ /^--^-` \'--` \n \\` " / \\7~" \n [--]\\\\ \\\\ \n L :| Xo >\\ \n /o |` \\ \\\\ \n [ I \\ .\\\\ \n | :l \\]/ \\ \n I_|` \\\\.Y \n]: L Z_I \nl]n[ 7-."\\ \n\\\\ I \\ \\ Y \n \\"]\\ \\ ]| \n \\.\\\\ \\:L \n \\ \\\\ _ 7_[ \n \\_K^"_"=-, _ \n ].-"~ "~-.[] [ ' self.__sprite[1] = ' T"-.,_ \n l: ~{--._ \n I: .` "c \n .--. l /.-~"-. | \nY /~("-, I___ )Y .--r_Y | \n\\_ "./~_~]__=~"j \\__L__[| \n \\~" \\T T.__~<--r.__./ |___ \n {--}]_L_,.) )( ( /\\___lc--\' \n Y /~("___\\ /^--^-` \'--` \n \\` " / \\7~" \n [--]\\\\ \\\\ \n L :|:| \n /o |` |` \n [ I I \n | :l :l \n I_|` |` \n]: L : L \nl]n[ n[ \n\\\\ I \\\\ I \n \\"]\\ "]\\ \n \\.\\\\ \\\\ \n \\ \\\\ \\_ \n \\_K^"_"=-, _ _ \n ].-"~ "~-.[] [] [ ' self.__sprite[2] = ' T"-.,_ \n l: ~{--._ \n I: .` "c \n .--. l \\.-~"-. | \nY \\~("-, I___ )Y .--r_Y | \n/_ ".\\~_~]__=~"j /__L__[| \n /~" /T T.__~<--r.__.\\ |___ \n {--}]_L_,.) )( ( \\/___lc--\' \n Y \\~("___/ \\^--^-` \'--` \n /` " \\ /7~" \n // //[--] \n Xo >/ :| \n / //o |` \n / .// I \n /]\\ /l \n //.Y \n Z_I \n |l7-."/ \n |/ / / Y \n / / ]| _ \n |/.//:L/_K^"_"=-, _ \n |_ ].-"~ "~-.[] [ \n /_K^"_"=-, _ \n ].-"~ "~-.[] [ ' self.__sprite[3] = ' T"-.,_ \n l: ~{--._ \n I: .` "c \n .--. l /.-~"-. | \nY /~("-, I___ )Y .--r_Y | \n\\_ "./~_~]__=~"j \\__L__[| \n \\~" \\T T.__~<--r.__./ |___ \n {--}]_L_,.) )( ( /\\___lc--\' \n Y /~("___\\ /^--^-` \'--` \n \\` " / \\7~" \n [--]\\\\ \\\\ \n L :|:| \n /o |` |` \n [ I I \n | :l :l \n I_|` |` \n]: L : L \nl]n[ n[ \n\\\\ I \\\\ I \n \\"]\\ "]\\ \n \\.\\\\ \\\\ \n \\ \\\\ \\_ \n \\_K^"_"=-, _ _ \n ].-"~ "~-.[] [] [ ' self.__sprite_width = max([ len(x) for x in self.__sprite[0].split('\n')]) self.__sprite_height = len(self.__sprite[0].split('\n')) self.__sprite[4] = [ [ ' ' for j in range(self.__sprite_width) ] for i in range(self.__sprite_height)] temp = [ '' for i in range(self.__sprite_height)] for i in range(len(self.__sprite[4])): temp[i] = ''.join(self.__sprite[4][i]) self.__sprite[4] = '\n'.join(temp) self.__acc = -9.8 self.__xacc = 0 self.__xvel = 0 self.__ground = 10 self.__ceil = 70 self.__ypos = self.__ground+self.__sprite_height self.__xpos = self._xpos # Inheritance self.__update_time = 0.1 self.__current_sprite = 0 self.__vel = 0 self.__end = 0 self.__score = 0 self.__prev = (self.__xpos,self.__ypos)
def __init__(self, x, y, Vx, Vy, properties=('slime', -1, -1)): # Properties should be a tuple of the form (STRING mobName, INT leftLimit, # INT rightLimit) where leftLimit and rightLimit can be -1 to remove the limit self.mobType = properties[0] self.limit = [properties[1], properties[2]] # Call base class implementation Character.__init__(self, x, y, Vx, Vy) # Load images self.slimeDL = pygame.image.load( 'enemies\\slime\\slimeGreen_squashed.png').convert_alpha() self.slimeDR = pygame.image.load( 'enemies\\slime\\slimeGreen_squashedR.png').convert_alpha() self.slimeL = pygame.image.load( 'enemies\\slime\\slimeGreen_walk.png').convert_alpha() self.slimeR = pygame.image.load( 'enemies\\slime\\slimeGreen_walkR.png').convert_alpha() self.flyDL = pygame.image.load( 'enemies\\fly\\fly_dead.png').convert_alpha() self.flyDR = pygame.image.load( 'enemies\\fly\\fly_dead_r.png').convert_alpha() self.flyL = pygame.image.load( 'enemies\\fly\\fly_fly.png').convert_alpha() self.flyR = pygame.image.load( 'enemies\\fly\\fly_fly_r.png').convert_alpha() self.fishDL = pygame.image.load( 'enemies\\other\\fishDead.png').convert_alpha() self.fishDR = pygame.image.load( 'enemies\\other\\fishDead_r.png').convert_alpha() self.fishL1 = pygame.image.load( 'enemies\\other\\fishSwim1.png').convert_alpha() self.fishL2 = pygame.image.load( 'enemies\\other\\fishSwim2.png').convert_alpha() self.fishR1 = pygame.image.load( 'enemies\\other\\fishSwim1R.png').convert_alpha() self.fishR2 = pygame.image.load( 'enemies\\other\\fishSwim2R.png').convert_alpha() self.snailL1 = pygame.image.load( 'enemies\\other\\snailWalk1.png').convert_alpha() self.snailL2 = pygame.image.load( 'enemies\\other\\snailWalk2.png').convert_alpha() self.snailR1 = pygame.image.load( 'enemies\\other\\snailWalk1R.png').convert_alpha() self.snailR2 = pygame.image.load( 'enemies\\other\\snailWalk2R.png').convert_alpha() self.snailDL = pygame.image.load( 'enemies\\other\\snailShell.png').convert_alpha() self.snailDR = pygame.image.load( 'enemies\\other\\snailShellR.png').convert_alpha() # Other control variables self.originalHeight = y self.alive = True self.health = 1 self.gravity = 1 self.runSpeed = abs(self.Vx) self.currentStep = 0 self.takenAction = False
def __init__(self, position): Character.__init__(self, 15, 2, 3, 4, { "ataque magico": 3, "golpe": 2, "patada": 1 }) self.position = Point(position.x, position.y + 1) Renderable.__init__(self, deepcopy(WIZARD_IMAGE), self.position)
def __init__(self): Character.__init__(self, 'Vampire', 50) # Attacks self.attacks.append(ATTACKS['Bite']) # Weaknesses self.weakness.append(ATTACKS['Stake']) self.weakness.append(ATTACKS['Fire'])
def __init__(self, health, mana, damage, mana_cost): Character.__init__( self, health=health, mana=mana ) self.damage = damage self.mana_cost = mana_cost
def __init__(self, name="Scary Monster", other=None): """ Initialize an enemy. Level is based on player's level. """ Character.__init__(self, name) self.level = self.init_level(other) self.exp_reward = self.init_exp_reward() self.max_health = self.init_health() self.current_health = self.max_health self.damage = self.init_damage()
def __init__(self, x, y): self.health = Survivor.START_HEALTH self.current = 0 # 0 -> pistol, 1 -> shotgun, 2 -> automatic self.direction = Direction.WEST self.img = pygame.image.load('images/survivor/survivor_w.png') Character.__init__(self, x, y)
def __init__(self): Character.__init__(self, 'Werewolf', 150) # Attacks self.attacks.append(ATTACKS['Bite']) self.attacks.append(ATTACKS['Tear']) # Weaknesses self.weakness.append(ATTACKS['Fire'])
def __init__(self, x, y): self.direction = Direction.WEST self.health = Zombie.START_HEALTH self.img = Zombie.ORIGINAL_ZOMBIE_IMAGE Character.__init__(self, x, y) Zombie.list_.append(self)
def __init__(self, position): Character.__init__(self, 10, 2, 3, 5, { "flecha": 3, "golpe": 2, "patada": 1 }) self.position = Point(position.x, position.y + 1) Renderable.__init__(self, deepcopy(ARCHER_IMAGE), self.position)
def __init__(self, world, image): Character.__init__(self, world, 100, 100, 32, 32) self.world = world self.display_text = "" self.image = image self.text = pygame.font.SysFont("None", 20).render("hello there", True, common.red)
def __init__(self): Character.__init__(self) self.setAbilities(str=13, con=12, dex=24, int=11, wis=15, cha=22) self.setSkills( acrobatics=True, athletics=True, bluff=True, perception=True, stealth=True, streetwise=True, thievery=True ) # racial bonuses self.skill["diplomacy"].miscBonus = 2 self.skill["insight"].miscBonus = 2 # Devastating Critical feat self.extraCrit = "1d10" # jet black stone bonus self.skill["stealth"].miscBonus = 4 self.proficiency["dagger"] = 3 + 1 # proficient + rogue class bonus self.proficiency["handCrossbow"] = 2 self.setLvl(17) # at-wills self.setPower(slyFlourish=SlyFlourish(), acrobaticStrike=AcrobaticStrike()) # encounters self.setPower( shadowJaunt=ShadowJaunt(), fadingStrike=FadingStrike(), jumpingBladeAssault=JumpingBladeAssault(), escapeArtistsGambit=EscapeArtistsGambit(), cleverMove=CleverMove(), sneakInTheAttack=SneakInTheAttack(), rockyIVPunch=RockyIVPunch(), criticalOpportunity=CriticalOpportunity(), tumblingDodge=TumblingDodge(), combatTumbleset=CombatTumbleset(), tornadoStrike=TornadoStrike(), oathOfEnmity=OathOfEnmity(), ) # dailies self.setPower( slayingStrike=SlayingStrike(), aerialAssault=AerialAssault(), trickStrike=TrickStrike(), badIdeaFriend=BadIdeaFriend(), ) self.setWeapon( misericorde=Misericorde(), poisonedCrossbow=PoisonedCrossbow(), cloakedDagger=CloakedDagger(), unarmed=Unarmed(), ) self.setEquip(main="misericorde")
def __init__(self, health, mana, damage): Character.__init__( self, health=health, mana=mana, weapon=None, spell=None ) self.damage = damage
def __init__(self, x, y, Vx=0, Vy=0, whichChar=1): Character.__init__(self, x, y, Vx, Vy, whichChar) # HUD images self.whichChar = whichChar self.heartEmpty = pygame.image.load( 'hud' + os.sep + 'hud_heartEmpty.png').convert_alpha() self.heartHalf = pygame.image.load( 'hud' + os.sep + 'hud_heartHalf.png').convert_alpha() self.heartFull = pygame.image.load( 'hud' + os.sep + 'hud_heartFull.png').convert_alpha() self.heartWidth = pygame.Surface.get_width(self.heartFull) self.heartHeight = pygame.Surface.get_height(self.heartFull) self.coin = pygame.image.load('hud' + os.sep + 'hud_coins.png').convert_alpha() self.coinWidth = pygame.Surface.get_width(self.coin) self.coinsMultiplier = pygame.image.load('hud' + os.sep + 'hud_x.png').convert_alpha() self.hudNumber = [] for i in range(0, 10): numberImage = pygame.image.load('hud' + os.sep + 'hud_' + str(i) + '.png').convert_alpha() self.hudNumber.append(numberImage) self.hudTextWidth = pygame.Surface.get_width(self.hudNumber[0]) self.playerCoins = [] for i in range(0, 3): playerCoinImage = pygame.image.load('hud' + os.sep + 'hud_p' + str(self.whichChar) + '.png').convert_alpha() self.playerCoins.append(playerCoinImage) self.key = pygame.image.load('hud' + os.sep + 'hud_keyBlue.png').convert_alpha() self.noKey = pygame.image.load( 'hud' + os.sep + 'hud_keyBlue_disabled.png').convert_alpha() # HUD variables self.spacing = 10 self.coins = 0 self.playerCoinCoords = (self.spacing, self.spacing) self.healthStart = (pygame.Surface.get_width(self.playerCoins[0]) + 2 * self.spacing, 10) self.healthInterval = self.spacing + self.heartWidth # Other variables if whichChar == 1: self.jumpSpeed = 35 self.runSpeed = 8.5 self.lives = 9 else: self.jumpSpeed = 36 self.runSpeed = 9.0 self.lives = 4 self.worldShiftCoefficient = 1.5 self.cpuControlled = False self.longestPlatform = None self.respawnPoint = None self.keys = pygame.key.get_pressed() # Keyboard key state
def __init__(self, name, title, health, mana, regeneration_rate): Character.__init__( self, health=health, mana=mana, ) self.name = name self.title = title self.regeneration_rate = regeneration_rate
def __init__(self, settings, screen, grid_pts): Character.__init__(self, settings, screen, grid_pts) self.settings = settings self.name = "fruit" self.set_start_position() self.lifespan = 5 self.timer = 0 self.destroy = False self.points = 100 self.image = self.settings.get_image(8, 2, 32, 32)
def load(name, center=None, walkDelay=settings.fps): jsonData = load_character_data(name) self = DumbBattleNPC() Character.__init__(self, center, jsonData['spritename']) DumbNPC.__init__(self, walkDelay) BattleCharacter.__init__(self, jsonData) return self
def __init__(self): Character.__init__(self) self.image = load_image(MOB, True) self.rect = self.image.get_rect() self.rect.x = random.randrange(-200, SCREEN_WIDTH + 200) self.rect.y = random.randrange(-100, -40) self.pos = vec(self.rect.x, self.rect.y) self.radius = 18 self.speed = vec(0, random.randrange(1, 4)) self.damage = 25
def __init__(self): Character.__init__(self) self.pos = rect.Pos(0.5, 0.5) # Multiplied by screen width. self.radius = 0.02 # Multiplied by screen width. self.velocity = 0.15 # Screen widths per second. self.running_time = None self.hand_offset = rect.Pos(0.6, 0.41) # Multiplied by the radius. self.gun = pistol.Pistol() self.max_health = 100 self.health = self.max_health
def __init__(self, level, race, name='no name'): Character.__init__(self,level, race, name) self.cclass = "Priest" self.stats() self.hp(8) self.base_attack_bonus(.75) self.base_saves() self.equipment() self.skills() self.totaltohit = int((max(self.stats.strength, self.stats.dexterity) - 10 ) / 2) + int(self.level * .75)
def __init__(self, level, race, name='no name'): Character.__init__(self,level, race, name) self.cclass = "Rogue" self.stats() self.base_attack_bonus(.75) self.hp(6) self.base_saves() self.equipment() self.skills() self.totaltohit = int(self.stats.dexterity) + int(.75 * self.level)
def __init__(self, level, race, name='no name'): Character.__init__(self,level, race, name) self.cclass = "Mage" self.stats() self.hp(4) self.base_attack_bonus(.5) self.base_saves() self.equipment() self.skills() self.totaltohit = self.base_attack_bonus
def __init__(self, name): Character.__init__(self, name, 100) # Player starts with these attacks self.attacks.append(ATTACKS['Sword']) self.attacks.append(ATTACKS['Fire']) self.attacks.append(ATTACKS['Stake']) # Only the player has strength and magick self.strength = 100 self.magick = 100
def __init__(self): Character.__init__(self, 'Zombie', 50) # Attacks self.attacks.append(ATTACKS['Bite']) self.attacks.append(ATTACKS['Tear']) self.attacks.append(ATTACKS['Moan']) self.attacks.append(ATTACKS['Bludgeon']) # Weaknesses self.weakness.append(ATTACKS['Sword']) self.weakness.append(ATTACKS['Fire'])
def __init__(self, level, race, name='no name'): Character.__init__(self,level, race, name) self.cclass = "Fighter" self.stats() self.hp(10) self.base_attack_bonus(1.0) self.base_saves() self.skills() self.ac = 10 + int((self.stats.dexterity - 10) / 2 ) self.equipment() self.totaltohit += int(1.0 * self.level) + int((self.stats.strength - 10) / 2)
def __init__(self, x, y, images, direction='Left'): Character.__init__(self, x, y, direction) self.score = Pacman.no_score self.life_score = Pacman.no_score self.lives = Pacman.three_lives self.level = Pacman.level_one self.last_direction, self.next_direction = 'Left', None self.is_respawning = False self.direction_image(images) self.invulnerable_ticks = Pacman.ticks
def __init__(self, name, title, health, mana, mana_regeneration_rate): Character.__init__( self, health=health, mana=mana, weapon=None, spell=None ) self.name = name self.title = title self.mana_regeneration_rate = mana_regeneration_rate self.checkpoint_position = (0, 0) print("You created a new hero", self)
def __init__(self, image_path, node, speed, mediator): Character.__init__(self, mediator) self.size = (25, 25) image_aux = pygame.image.load(image_path) image_aux = pygame.transform.scale(image_aux, self.size) self.image = image_aux self.rect = self.image.get_rect() start_position_x = node[0] * mediator.game_screen.pxl_x + 1 start_position_y = node[1] * mediator.game_screen.pxl_y + 1 self.start_position = (start_position_x, start_position_y) self.rect.x = start_position_x self.rect.y = start_position_y self.speed = speed
def __init__(self, x, y): # set the image and direction for the rotation/initial self.direction = 'e' self.img = Zombie.survivor_img[randint(0, 2)] self.original_img = self.img self.speed = 4 # set the currently heath when create a new zombie self.health = Zombie.health # create the character, and position, from inheritante Character.__init__(self, x, y) Zombie.List.append(self)
def __init__(self, position): """Initialize player by extending class Character, adding an inventory. :param position: Player position """ Character.__init__(self, position) self.inventory = pygame.sprite.Group() self.image = pygame.image.load("sprites/mcgyver.png") self.rect = self.image.get_rect() self.x_pos = position[1] * 32 self.y_pos = position[0] * 32 # Speed at which player moves. self.speed = 3
def __init__(self): Character.__init__(self) self.setAbilities(str=12, con=10, dex=10, int=12, wis=18, cha=17) self.setSkills(heal=True, insight=True, arcana=True, history=True, religion=True) #background trait self.skill['insight'].miscBonus = 2 #combat medic feat bonus self.skill['heal'].miscBonus = 2 #armor penalties self.skill['acrobatics'].miscBonus = -1 self.skill['athletics'].miscBonus = -1 self.skill['endurance'].miscBonus = -1 self.skill['stealth'].miscBonus = -1 self.skill['thievery'].miscBonus = -1 #proficiencies (only bothering with relevant ones) self.proficiency['staff'] = 2 self.proficiency['mace'] = 2 self.proficiency['implement'] = 1 #implement expertise feat self.setLvl(5) #at-wills self.setPower(lanceOfFaith=LanceOfFaith(), sacredFlame=SacredFlame(), astralSeal=AstralSeal()) #encounters self.setPower(shieldBearer=ShieldBearer(), channelDivinityTurnUndead=ChannelDivinityTurnUndead(), channelDivinityDivineFortune=ChannelDivinityDivineFortune(), healingWord=HealingWord(), hymnOfResurgence=HymnOfResurgence(), radiantSmite=RadiantSmite()) #dailies self.setPower(astralCondemnation=AstralCondemnation(), shieldOfFaith=ShieldOfFaith(), spiritualWeapon=SpiritualWeapon()) self.setWeapon(mace=Mace(), orbOfLight=OrbOfLight()) self.setEquip(main='mace', implement='orbOfLight')
def __init__(self, lives, mediator): Character.__init__(self, mediator) self.size = (int(mediator.game_screen.pxl_x - 1), int(mediator.game_screen.pxl_y)) for i in range(1, 4): image_aux = pygame.image.load('images/Walk(' + str(i) + ').png') image_aux = pygame.transform.scale(image_aux, self.size) self.images.append(image_aux) self.image = self.images[0] self.rect = self.image.get_rect() self.rect.x = int(self.mediator.game_screen.pxl_x) + 1 self.rect.y = int(self.mediator.game_screen.pxl_y) + 1 self.lives = lives
def __init__(self, x, y, enemy_type, images, direction=None): ''' Initializes an Enemy class that inherits from the Character Class. The enemy class is one of the two classes that has movement involved, and different attributes to represent the state. The enemy_type is given by argument, and there are 4 different enemy types because each enemy is unique. ''' Character.__init__(self, x, y, direction) self.enemy_type = enemy_type self.invulnerable = True self.slowed_down = False self.determine_image(enemy_type, images) self.pickup_memory = None if enemy_type == Enemy.inky or enemy_type == Enemy.clyde: # Only Inky and Clyde require these Attributes self.movement_turns = 15 self.last_choice = None
def __init__(self, x_coord, imgFile): Character.__init__(self, imgFile) self.rect.x = x_coord self.speed = 5 self.move_direction = 0 self.health = 100 self.gold = 0 self.level = 1 self.images = [] # 0=idle, 1=running#1 , 2=running#2 for i in range(3): image = pygame.Surface([100, 200], pygame.SRCALPHA, 32).convert_alpha() image.blit(self.image, (0, 0), (i*100, 0, 100, 200)) self.images.append(image) self.images.append(pygame.transform.flip(self.images[0], True, False)) self.images.append(pygame.transform.flip(self.images[1], True, False)) self.images.append(pygame.transform.flip(self.images[2], True, False)) self.flipped_img = pygame.transform.flip(self.image, True, False) self.max_stamina = 6 self.stamina = self.max_stamina self.sprint = False self.sprint_capable = True self.show_instructions = 0 self.menu = [] self.whole_menu = { 1: ('NPC', { 1: ('Get Money', ''), 2: ('Pay to work for you', '') }), 2: ('Build', { 1: ('Bank', 'structure_list.append(bank.bank(self.rect.x + Camera.current_screen_x_pos))'), 2: ('Farm', 'structure_list.append(farm.Farm(self.rect.x + Camera.current_screen_x_pos))'), 3: ('Stonewall', 'structure_list.append(stonewall.stonewall(self.rect.x + Camera.current_screen_x_pos))'), 4: ('Townhall', 'structure_list.append(townhall.townhall(self.rect.x + Camera.current_screen_x_pos))'), }), 3: ('Upgrade', {}) } self.frame_counter = 0
def __init__(self, x, imgFile="archer_sprite.png"): Character.__init__(self, imgFile=imgFile) self.images = [] # 0=idle, 1=running#1 , 2=running#2 for i in range(3): image = pygame.Surface([100, 200], pygame.SRCALPHA, 32).convert_alpha() image.blit(self.image, (0, 0), (i*100, 0, 100, 200)) self.images.append(image) self.images.append(pygame.transform.flip(self.images[0], True, False)) self.images.append(pygame.transform.flip(self.images[1], True, False)) self.images.append(pygame.transform.flip(self.images[2], True, False)) self.rect = self.images[0].get_rect() self.arrowspeed = 0 self.image_dir = "right" self.rect.x = x self.rect.y = 450 self.idle_job = [0, 0] #[job, time when to stop] jobs: 0=right, 1=left, 2=wait
def __init__(self, b2World, eventMgr, pos): Character.__init__(self) self.em = eventMgr eventMgr.register(self) self.keys = [False] * 5 self.pickups = [] self.pickups.append(Pickup("no_hurry", 200)) self.animation_frames = map(pygame.image.load, ["media/nja2_lf1.png", "media/nja2_lf2.png", "media/nja2_rt1.png", "media/nja2_rt2.png", "media/nja2_fr1.png"]) self.frame_count = 2 self.image = self.animation_frames[0] self.animation_step = 0 self.frame_interval = 10 self.frame = 0 self.font = pygame.font.Font(None, 20) self.going_left = False self.going_right = False self.upsidedown = False self.midair = True self.can_double_jump = True self.time_since_jump = 0 self.rect = self.image.get_rect() self.rect.topleft = pos self.rect.width = 32 self.rect.height = 32 self.xspeed = 400 self.jumping_power = 200 self.default_jumping_power = 200 self.score = 0.0 self.max_height = 0 self.trampoline_height = 250 self.createBody(b2World, self.rect.width, self.rect.height )
def __init__(self, world_map, energy, side): self.side = side self.energy = energy Character.__init__(self, world_map, world_map.group, world_map.enemies_group)
def __init__(self, world_map, number, frames): self.spikes = [None]*number self.frame_count = 0 self.frames = frames self.number = number Character.__init__(self, world_map, world_map.group)
def __init__(self, league, name, health, brawl, shoot, dodge, might, finesse, cunning, *abilities): Character.__init__(self, league, name, health, brawl, shoot, dodge, might, finesse, cunning, abilities)
def __init__(self, life_points, enemy_counter): Character.__init__(self, "Skeleton", life_points, enemy_counter)
def __init__(self, world_map): Character.__init__(self, world_map, world_map.group, world_map.special_items_group)
def __init__(self, weapons = None): for weapon in weapons: weapon.owner = self Character.__init__(self, "Ray", STR = 12, DEX = 9, SOR = 6, weapons = weapons) return
def __init__(self,x,y,level): Character.__init__(self,x,y) self.facingRight = True self.level = level
def __init__(self): Character.__init__(self) self.image = pygame.image.load("media/character.png") self.rect = self.image.get_rect()
def __init__(self, scene, size, color, name, speed, hp): Character.__init__(self, scene, size, color, name, speed, hp) self.rect.move_ip([ size[0] * randint(0, self.scene.room.num_tiles[0]), size[1] * randint(0, self.scene.room.num_tiles[1]) ])
def __init__(self, lifePoints, attackPoints, enemy_counter): Character.__init__(self, "Warrior", lifePoints, attackPoints) self.enemy_counter = enemy_counter
def __init__(self, data, level=1): Character.__init__(self, data) #Scale up the NPC to match the player level self.put('combat/level-hitdice', level) self.roll_hit_dice() self.weapons
def __init__(self, world_map, *groups): Character.__init__(self, world_map, *groups)
def __init__(self, *args, **kwargs): Character.__init__(self, *args, **kwargs)