I have already stated the issues beforehand in other threads. Fixing those issues would reduce your code.
The first simple one to reduce code is your loading of images. A simple method of loading images since yours are all in one directory is to load all PNG's in that directory. Then use the filename as the dictionary key. A simple for loop would reduce 50 lines of hard coded image loads to just a few.
All your time sleeps everywhere add a single line on every function. It is also slowing your program down and glitching your GUI. During the half second, nothing happens. No logic and no drawing to the screen.
Your drawWeap method is redundant and can be reduced by splitting logic from drawing. This occurs in all of your classes.
Things like this
I will leave it there. Because you do not have a good track record for applying what people tell you to change. And there is no point in me spending any more time looking at your code if you are not going to apply what i suggest.
The first simple one to reduce code is your loading of images. A simple method of loading images since yours are all in one directory is to load all PNG's in that directory. Then use the filename as the dictionary key. A simple for loop would reduce 50 lines of hard coded image loads to just a few.
All your time sleeps everywhere add a single line on every function. It is also slowing your program down and glitching your GUI. During the half second, nothing happens. No logic and no drawing to the screen.
Your drawWeap method is redundant and can be reduced by splitting logic from drawing. This occurs in all of your classes.
Things like this
if self.direct == 'Left': WeapRect = self.weapType[3] WeapRect = WeapRect.get_rect() WeapRect[0] = self.rect[0] - round(self.width*.8) WeapRect[1] = self.rect[1] + round(self.height/2) elif self.direct == 'Right': WeapRect = self.weapType[1] WeapRect = WeapRect.get_rect() WeapRect[0] = self.rect[0] + round(self.width*.8) WeapRect[1] = self.rect[1] + round(self.height/2) elif self.direct == 'Up': WeapRect = self.weapType[0] WeapRect = WeapRect.get_rect() WeapRect[0] = self.rect[0] + round(self.width/2) WeapRect[1] = self.rect[1] - round(self.height*.8) elif self.direct == 'Down': WeapRect = self.weapType[2] WeapRect = WeapRect.get_rect() WeapRect[0] = self.rect[0] + round(self.width/2) WeapRect[1] = self.rect[1] + round(self.height*.8)You are copying code to apply to each direction. With dictionaries, you can do this once instead of copy and pasting for each direction. You do this quite often everywhere. Which would reduce your code by 75%.
I will leave it there. Because you do not have a good track record for applying what people tell you to change. And there is no point in me spending any more time looking at your code if you are not going to apply what i suggest.
Recommended Tutorials: