Skip to content
Advertisement

When I start this code, i found a problem with error Traceback (most recent call last) in my code with pygame module

I have problem with function. I starting learn pygame with video course, and this is my first pygame code. My .py code:

JavaScript

enter image description here drawcube()

I wanna do a mini-game with stickman, and i found a very big problem, when I start game in cmd and I’m going to web to found decision, but.. I don’t find him. Please guys, I realy need help((

Advertisement

Answer

walkaniml and walkanimr are pygame.Surface objects. You can’t call an object:

win.blit(walkaniml(animcount // 1, (x, y)))

JavaScript

If walkaniml and walkanimr are a list of Surfaces, you can get an element from the lists by it’s index with subscription (even if the list contains only 1 element):

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement