Python Pygame Tutorial – Sprite Sheets



Thank you for watching my video and I really hope you found something useful.

Pygame on Facebook: https://www.fb.com/groups/pygame

Hello to you! In this episode I’ll be examining sprite
sheets and blitting individual cells to the display
surface.

If you’d like to know how to install and run your first Python Pygame script then watch my first video here: https://youtu.be/XAcnyCFRRpw

Download the script and image files for this tutorial…

Related Posts

32 Comments

  1. Nice and useful video, thanks!
    Small note: in Python 3.7 you must write index//cols*h instead of index/cols*h, else you will get a shifted frame from index 1

  2. Awesome tutorial.. Not only do you show what to do, you explain why.. that is sooo lacking in most tutorials. Appreciate the efforts, New subscriber here, looking forward to watching all your tutorials,

  3. I have always been wondering how to use sprite sheets, and I could never figure it out. Thank you! You have saved me from a lot of headaches, and have also given me new power and energy to work on my game!!

  4. Greetings, I'm getting into python codding and found your channel. First off thank you for your great videos. Second is a question. Are you a Ham Radio operator as wall as a code writer? I ask due to you intro. I love sending Morse Code in CW Mode and was instantly intrigued. Thanks and 73

  5. Hello!
    Should you help me to understand handle and offset? I saw the video n times and don't understand.
    I can read better than listen. So if you can help me, I will so glad.
    About my text, I hope you can understand.
    Thanks!

  6. Hi, first, AMAZING VIDEO! Second XD, I am experiencing an error when attempting to run the script (I am using Python 3.x and I think almost everything is adjusted for 3):

    local variable 'index' referenced before assignment

    and it is having the issue with:

    Rosa.draw(gameDisplay,index % Rosa.totalCellCount,HW,HH,CENTER_HANDLE)

    I can send the rest of the script if needed, I have this:

    Rosa = spritesheet("ROSA PARKS-SPRITE SHEET.png",1,3)
    CENTER_HANDLE = 3
    index = 0

    written below the class spritesheet but, outside of the class/functions. Any and all help will be very much appreciated!

  7. Thanks for these videos. Just discovered your channel and it has helped me so much. I am working on a 2D platform type game with a couple of my nerd-friends. Subscribed! 🙂

  8. For me as a total noob it was a little hard to follow first, but I sticked to the end and then broke down every line of the code to understand it. Then I've removed the handle method, since it was not necessary for my purposes and the code looked much more simple! I wished you had skipped this part in the first place, but dude, your tutorial was so awesome! I dont understand why you have so few subscribers. Thanks!

  9. If I wanted to run my game at say 120fps but I didn't want to cycle through my walking sprites that fast how would I put in a delay between sprites without delaying the whole program? So that maybe I cycle through my sprites at 8 fps? Thanks!

  10. I wonder if you can solve a problem for me relating to spritesheets. I've been able to colour the unwanted background of a sprite in alpha when loading it from its own file, but having loaded an image from a spritesheet, suddenly the unwanted colour reappears. Any ideas?

Leave a Reply

Your email address will not be published.

© 2022 Code As Pro - Theme by WPEnjoy · Powered by WordPress