def __init__(self, x, y, type, player): """ current types are 'demon' and 'knight' """ # initialize parent, load frames into visual sprite component keys = ('death', 'demon', 'knight') EntityBase.__init__(self, x, y, 'content/proto-battle.png', [(constants.BW*3*(i+1), 0, constants.BW*3, constants.BW*3, constants.BW*constants.SF, constants.BW*constants.SF, keys[i]) for i in range(3)]) self.type = type self.visual.setFrame(type) self.target = player self.hitBox = game.entities.hitBox.HitBox()
def __init__(self, x, y, tileNum): rowsInSpriteSheet = rows = 2 colsInSpriteSheet = cols = 4 numGrassTiles = 8 # load frames into visual sprite component keys = ['grass' + str(i) for i in range(numGrassTiles)] + ['wall'] # initialize parent, only load one initial frame for tile infoList = [(0 + constants.SPRITE_WIDTH * (tileNum % cols), 0 + constants.SPRITE_HEIGHT * (tileNum // cols), constants.BOX_WIDTH, constants.BOX_WIDTH, 0, 0, keys[tileNum])] EntityBase.__init__(self, x, y, 'content/proto-tilesheet.png', infoList) # set the frame self.visual.setFrame(keys[tileNum])
def __init__(self, x, y): # initialize parent, load frames into visual sprite component keys = ('standRight', 'standDown', 'standLeft', 'standUp', 'standRightSword', 'standDownSword', 'standLeftSword', 'standUpSword', 'swingRightSword', 'swingDownSword', 'swingLeftSword', 'swingUpSword') EntityBase.__init__(self, x, y, 'content/proto-player.png', [(constants.SW*i, 0, constants.SW, constants.SH, 0, (constants.SH-constants.BW)*constants.SF, keys[i]) for i in range(8)] + [(constants.BW*3*i, 26, constants.BW*3, constants.BW*3, constants.BW*constants.SF, constants.BW*constants.SF, keys[8+i]) for i in range(4)]) self.getFrames('content/proto-battle.png', [(constants.BW*3, 0, constants.BW*3, constants.BW*3, constants.BW*constants.SF, constants.BW*constants.SF, 'death')]) self.direct = 'Down' self.visual.setFrame(keys[1]) # intialize attributes self.hasSword = False