Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Walking Figure in pygame
#1
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 += 1
But it walks just in half of the screen. I want it to walk a whole screen. Can you help me? Thank you very much
Reply
#2
Uh, shouldn't this be in the game development section?
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply
#3
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pygame*import pygame ImportError: No module named pygame CASPERHANISCH 1 9,772 Jun-05-2017, 09:50 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020