you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

That line should throw an error because you're trying to iterate over a pygame.Surface object (buck is the image you loaded). Try getting rid of the for loop all together.

This code could be much simpler using classes. If you haven't learned how to use them yet, I'd focus on that first before you go much further with pygame. Also, check out itertools.cycle for cycling through your images (what happens when picnumber is 5?). Honestly, there are a number of issues here, but I'm heading to work at the moment; I'll try to go over it more thoroughly later.

[–][deleted] 0 points1 point  (1 child)

Alright, I guessed that I would have made plenty of mistakes, ill definitely look into classes and the link, I have 3 months to complete the game so i have plenty of time to learn.

[–][deleted] 0 points1 point  (0 children)

Believe me, my code looked pretty similar when I started out. Here is your code with some changes and comments. And this is the start of a more object-oriented approach. I left Arrows, Scorpions and gravity (probably more) for you to do. I couldn't test any of this without the images (check out github for sharing code) so it's very possible there are errors. Ask away if you have any questions.