Hoo boy, I think I've been struggling silently for long enough, and it's time to reach out for some help.
For the past few years, it's always been a dream of mine to learn game programming. I already know how to draw graphics, compose music and write a story, so programming is my final hurdle for becoming an indie developer. So far, I understand many of the basics of PyGame such as functions and classes, as well as how to do basic math. I've managed to create a screen, draw a character and set up some acceleration-based movement as well as a running. The problem is, I'm having difficulties loading a sprite sheet and extracting individual sprites from that sheet to animate my character.
Attached is a .ZIP file containing my PyGame project so far. Running "Game Old.py" will give you a surface-based graphics engine. The game loads the entire sprite sheet as a giant sprite, and uses that for the character. The player's velocity is also printed once per frame.
It's in "Game.py" where I'm having my problem. I'm trying to create a 32x32 surface for each animation frame using a while loop, but attempting to do this produces a list of empty surfaces. Is there a problem with my while loop? Should I use a for loop like the example shown here?
For the past few years, it's always been a dream of mine to learn game programming. I already know how to draw graphics, compose music and write a story, so programming is my final hurdle for becoming an indie developer. So far, I understand many of the basics of PyGame such as functions and classes, as well as how to do basic math. I've managed to create a screen, draw a character and set up some acceleration-based movement as well as a running. The problem is, I'm having difficulties loading a sprite sheet and extracting individual sprites from that sheet to animate my character.
Attached is a .ZIP file containing my PyGame project so far. Running "Game Old.py" will give you a surface-based graphics engine. The game loads the entire sprite sheet as a giant sprite, and uses that for the character. The player's velocity is also printed once per frame.
It's in "Game.py" where I'm having my problem. I'm trying to create a 32x32 surface for each animation frame using a while loop, but attempting to do this produces a list of empty surfaces. Is there a problem with my while loop? Should I use a for loop like the example shown here?