Sep-01-2020, 04:44 PM
I moved the "player" functions to the class.I have a problem with drawing.I get an error "TypeError: draw() missing 1 required positional argument: 'screen'"
game.py
game.py
class GAME:
def __init__(self):
pg.init()
self.screen = pg.display.set_mode((HEIGHT,WIDTH))
pg.display.set_caption(TILE)
self.clock = pg.time.Clock()
self.load_data()
self.player = Player()
...
...
def draw(self):
...
self.player.draw()
...player.py class Player(object):
def __init__(self):
self.x = 10
self.y = 10
self.image = "gfx\120.jpg"
self.K =30
def draw(self,screen):
screen.blit(self.image,(self.x*self.K,self.y*self.K))
def move_left(self):
self.x =self.x -1
def move_right(self):
self.x = self.x +1
def move_up(self):
self.y =self.y -1
def move_down(self):
self.y = self.y+1
