import pygame, sys, math

class Arm(pygame.sprite.Sprite):
    def __init__(self, player):
        pygame.sprite.Sprite.__init__(self, self.containers)
        self.player = player
        self.baseImage = pygame.image.load("rsc/ball/PlayerArm.png")
        self.baseImage = pygame.transform.scale(self.baseImage, [100,100])
        self.image = self.baseImage
        self.rect = self.image.get_rect()
        self.angle =0
    
    def aim(self, mousePos):           #https://github.com/scscorley/jellitubby-attack/blob/master/Vacuum.py
        """rotate an image while keeping its center and size"""
        mousePosPlayerX = mousePos[0] - self.rect.center[0]
        mousePosPlayerY = mousePos[1] - self.rect.center[1]
        self.angle = ((math.atan2(mousePosPlayerY, mousePosPlayerX))/math.pi)*180
        self.angle = -self.angle
        
        rot_image = pygame.transform.rotate(self.baseImage, self.angle)
        rot_rect = self.rect.copy()
        rot_rect.center = rot_image.get_rect().center
        rot_image = rot_image.subsurface(rot_rect)
        self.image = rot_image
    
    def update(self):
        self.rect.center = [self.player.rect.x+46, 
                            self.player.rect.y+38]

#

@@ -17,16 +17,37 @@
 ys, math
+%0Afrom Player import *
 %0A%0Aclass 
@@ -204,33 +204,99 @@
        self.
-baseImage
+runRight = pygame.image.load(%22rsc/ball/PlayerArm.png%22)%0A        self.runLeft
  = pygame.im
@@ -315,32 +315,36 @@
 c/ball/PlayerArm
+Left
 .png%22)%0A        s
@@ -351,20 +351,126 @@
 elf.
-baseImage
+restRight = %5Bpygame.transform.scale(pygame.image.load(%22rsc/ball/PlayerArm.png%22), %5B100,100%5D)%5D%0A        self.restLeft
  = 
+%5B
 pyga
@@ -488,30 +488,63 @@
 m.scale(
-self.baseImage
+pygame.image.load(%22rsc/ball/PlayerArmLeft.png%22)
 , %5B100,1
@@ -547,16 +547,17 @@
 00,100%5D)
+%5D
 %0A       
@@ -567,24 +567,25 @@
 lf.image
+s
  = self.
 baseImag
@@ -576,25 +576,97 @@
  = self.
-baseImage
+restRight%0A        self.state = %22rest right%22%0A        self.prevState = %22rest right%22
 %0A       
@@ -1519,10 +1519,659 @@
 .y+38%5D%0A%0A
-#
+        if self.prevState != self.state:%0A            self.prevState = self.state%0A            if self.player.state == %22run right%22:%0A                self.images = self.runRight%0A                self.rect.center = %5Bself.player.rect.x+37, %0A                self.player.rect.y+38%5D%0A            if self.player.state == %22run left%22:%0A                self.images = self.runLeft%0A                self.rect.center = %5Bself.player.rect.x+51, %0A                self.player.rect.y+38%5D%0A            if self.player.state == %22rest right%22:%0A                self.images = self.restRight%0A            if self.player.state == %22rest left%22:%0A                self.images = self.restLeft
 %0A

WORK IN PROGRESS