Walking Figure in pygame - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Walking Figure in pygame (/thread-26572.html) |
Walking Figure in pygame - adninqasifa - May-05-2020 Hey Guys, I make a walking figure with pygame like this: win = pygame.display.set_mode((852,480)) def __init__(self, x, y, width, height, end): self.x = x# self.y = y self.width = width self.height = height self.path = [x, end] self.vel = 3 def draw(self,win): # almost same with player(object) self.move() if self.walkCount + 1 >= 33: self.walkCount = 0 if self.vel > 0: # If we are moving to the right we will display our walkRight images win.blit(self.walkRight[self.walkCount//3], (self.x,self.y)) self.walkCount += 1 else: # Otherwise we will display the walkLeft images win.blit(self.walkLeft[self.walkCount//3], (self.x,self.y)) self.walkCount += 1But it walks just in half of the screen. I want it to walk a whole screen. Can you help me? Thank you very much RE: Walking Figure in pygame - pyzyx3qwerty - May-06-2020 Uh, shouldn't this be in the game development section? RE: Walking Figure in pygame - michael1789 - May-07-2020 There isn't enough info here to help. The def __init__ is a class constructor, but what is the class and where do you create the instance?What is self.move()? That seems important and would likely be where it is told only to walk half the screen. All I could suggest now is to make an actual pygame sprite. |