Pygame Tutorial #3 - Character Animation & Sprites
Why Stack Overflow recommends it
Stack Overflow users mention it when they are asking for help debugging code they wrote while following along, such as sprite list indexing errors and image loading failures.
Recommended by 0 people across 0 different months, 2019 to 2021.
What it is
Part 3 of Tech With Tim's Pygame series for Python 3.6. It shows how to load images into a Pygame program and use them as sprites to animate a character walking, running and jumping.
What people said
Cites Mook · 2019-01 · Stack Overflow · on “pygame object not subscriptable”
Traceback (most recent call last): File "C:\Users\Austin\PycharmProjects\Project\pygame\pygame1.py", line 84, in <module> redrawGameWindow() File "C:\Users\Austin\PycharmProjects\Project\pygame\pygame1.py", line 34, in redrawGameWindow win.blit(walkLeft[walkCount//3], (x, y)) TypeError: 'pygame.Surface' object is not subscriptable Error occurs when I move the picture I am using as my avatar left and right. Can't quite figure out what to change. I am following along this YouTube video to just look into pygame: [this video] As far as I can tell his code is the same as mine except for my images being different. import pygame pygame.init() win = pygame.display.set_mode((500, 500)) pygame.display.set_
Cites Nicholas Obert · 2019-08 · Stack Overflow · on “How to fix: "pygame.error: Couldn't open image"”
I'm new to python and I'm trying to use the "pygame" module to make a simple game where a character jumps across the screen. I'm currently using python 3.7 I watched Tech with Tim's tutorial about pygame (here the link: [this video] ) I've already searched on Stack Overflow a solution, but not found what I was searching for. I had a similar problem when trying to open image files using the "tkinter" module. I tried to use absolute paths and relative paths, but none of them worked. here are the lines that throw an error when ran win_background = pygame.image.load('C:/Users/Nicholas Obert/Downloads/New/flowers 500x500px.jpg') # this is line 12 c_sprite = pygame.image.load('C:/Users/Nicholas Obert/D
Cites Tofumaks · 2021-03 · Stack Overflow · on “Can anyone help me solve this pygame TypeError I get with my code?”
Hello I am new to stack overflow and python and I need some help with this coding error I get. I followed Tech with Tim's tutorial on creating sprite movement and I'm coming across an error message when I move my sprite around. Here's a link to the video I followed: [this video] The jump movement seems to be working but I get an error message when I move my character/sprite more than 3 steps to the left/right. Here's the error message I get: Traceback (most recent call last): File "C:\Users\Desktop\PYGAME Folder\Game Code.py", line 90, in <module> redrawGameWindow() File "C:\Users\Desktop\PYGAME Folder\Game Code.py", line 40, in redrawGameWindow win.blit(walkRight[walkCount//3], (x,y)) TypeError: