def __init__(self, parts): self.owner = None self.image = res.load_image('blank.png') self.frame_count = 0 self.animation = None self.idle = None self.attack1 = None self.attack2 = None self.cast1 = None self.cast2 = None self.hit1 = None self.hit2 = None self.portrait = res.load_image('blank.png') self.images = self.build_sprite(parts) self.rect = self.images[0].get_rect
def __init__(self, x, y, file, selection): self.graphic = res.load_image(file) rect = pygame.Rect(x, y, self.graphic.get_width() + 2, self.graphic.get_height() + 2) super(ImageButton, self).__init__(rect) self.selection = selection
def __init__(self, files, pos=(0, 0), spacing=(640, 480), speed=0.25): self.images = [] for file in files: self.images.append(res.load_image(file)) self.pos = pos self.spacing = spacing self.frame = 0 self.speed = speed
def __init__(self): super(Slayer, self).__init__(['default_slayer']) self.idle = Animation(frames = range(91, 96), speed=0.15) self.attack1 = Animation(frames = range(0, 10), speed=0.4) self.cast1 = Animation(frames = range(75, 90), speed=0.4) self.hit1 = Animation(frames = range(96, 99), speed=0.12) self.play_animation(self.idle) self.height = 120 self.center = (125, 198) self.portrait = res.load_image('SlayerIcon.png')
def __init__(self): super(Fighter, self).__init__(['default_fighter']) self.idle = Animation(frames = range(132, 136), speed=0.15) self.attack1 = Animation(frames = range(30, 36), speed=0.4) self.attack2 = Animation(frames = range(65, 71), speed=0.4) self.cast1 = Animation(frames = range(92, 95)+range(93, 95), speed=0.4) self.hit1 = Animation(frames = range(76, 78), speed=0.12) self.play_animation(self.idle) self.height = 120 self.center = (62, 150) self.portrait = res.load_image('FighterIcon.png')
def __init__(self, caller): frames = [ 'player_action.png', 'enemy_reaction.png', 'enemy_action.png', 'player_reaction.png' ] self.frame = [] self.caller = caller for frame in frames: self.frame.append(res.load_image(frame)) self.rect = pygame.Rect(int(320 - self.frame[0].get_width() / 2), 0, self.frame[0].get_width(), self.frame[0].get_height()) super(TurnIndicator, self).__init__(self.rect) self.selection = 'turn'
import pygame import main from resources import res MODE = 640, 480 pygame.display.init() pygame.mixer.pre_init(buffer=2048) try: pygame.mixer.init() except Exception: pass pygame.display.set_mode(MODE, pygame.RESIZABLE) pygame.display.set_caption('Arad Tactics') pygame.display.set_icon(res.load_image('icon.png')) main.Main().run()
def __init__(self, file, pos=(0, 0), spacing=(640, 480)): self.image = res.load_image(file) self.pos = pos self.spacing = spacing