Issue With Script Using Pygame
I'm writing a small game in my spare time. This is what I have so far: from pygame import * #import relevant modules from PIL import Image import os, sys init() #initialise class
Solution 1:
In code
defresize(self, sh, sw):
self.image = transform.scale(self.image, (sh, sw))
returnself.image
you returns image which is Surface instance - so in line
player = player.resize(20, 20)
you replace sprite instance with Surface instance
But you don't have to assign it to player again.
Do:
defresize(self, sh, sw):
self.image = transform.scale(self.image, (sh, sw))
# without return# without player =
player.resize(20, 20)
After that player.move(...) will work again.
And again you will have to use player.image in blit()
Post a Comment for "Issue With Script Using Pygame"