def __init__(self, midbottom, data): Entity.__init__(self, data) self.add(data.playerGroup) self.add(data.mobs) # red theme colour - currently unused colourDict = { (206, 209, 138): (206, 138, 138), # robe (170, 192, 171): (191, 170, 170), # shoes and hat (206, 201, 175): (204, 184, 173), # skin (233, 234, 232): (233, 234, 232) } # moustache animImages = {} for animName in [ 'run', 'jump', 'idle', 'cast', 'push', 'pull', 'grab' ]: animImages[animName] = pygame.image.load( 'assets/mobs/player/%s.png' % (animName)) #animImages = self.setColours(colourDict, animImages) self.initAnimations(animImages) collisionRect = pygame.Rect((0, 0), (83, 120)) collisionRect.midbottom = midbottom self.collisions = CollisionComponent(self, collisionRect, True) self.gravity = GravityComponent(self) self.obeysGravity = True self.weight = 1 self.movedThisFrame = False self.moveSpeedModifier = { 'left': 0, 'right': 0 } # a number added on to the player's moveSpeed every frame # eg when pushing a crate self.xVel = self.yVel = 0 self.facing = 'R' self.isOnGround = False self.lastTimeOnGround = 0 self.releasedJumpButton = True self.animation.play('idleR') self.animation.update() self.rect = self.image.get_rect(midbottom=midbottom) self.pullRect = pygame.Rect((0, 0), (40, self.rect.height)) self.pullStartFacing = None self.isPulling = False