Hey Russ I just picked up pygame this week and was in desperate need for beginner tutorials, especially animation. You do a great job with these I appreciate it! Much love ❤️
How did a 70-views video show up in my recommended? Anyways, I'm glad it did! Even though it's not something I was looking for right now it definitely was still interesting and something I'm looking forward to add to my little game! Thanks!
I believe in in a saying that, "even the smallest friends can help the biggest." not sure if my spelling is correct, nor the analogy. but hope you understand what I mean.
Hey , I was on the Third video of your Shooter game. I was a bit confused with Sprites and wanted to watch one video wholly dedicated on it. But I couldn't find the perfect one. What a great Timing. Thank you for Uploading this, I'm gonna watch this first and then Continue the shooter game. You contents are DOPE 💥💥.I would love to watch you making a car game with pygame. Thanks
Thanks! Good timing :) I plan to make some more of these tutorials which focus on specific tasks like animation, collision etc. After that I will go back to making full game tutorials again
I've done that in a few of my games, check out the shooter tutorial as that uses a few animations for the player: th-cam.com/video/DHgj5jhMJKg/w-d-xo.html
i use this for 8 directional movement and more, but 4 images in each step and 8 in an animation to spin around and if i move while on a frame above 4 i get error and crash because move images are 1-4
Thanks that's really clear and very instructive. But what's the advantages of having a sprite in one big file instead of multiple files that we can just load and not bother with all the positioning part ?
It can sometimes be limited to the sprites that you are using, unless you make your own assets. When you get 3rd party asset packs, they are often arranged in spritesheets that you then need to extract your images from.
Hey Russ! May I ask what should I do with multiple spritesheets? I have one for idle animation and one for running but I don't want to merge them together. This is a 5 month old video so I guess you'll never respond but I'll put it out anyway. I appreciate your video though! Great tutorial.
@@sontoby7309 if I remember correctly, I did solve it by making the sprite rendering part into a separate function that takes in spritesheets. But again, it’s a 2-year-old issue, so don’t expect a good answer from me.
Hi russ, thank you for tutorial, it really helped me, but I have a question: do you think the animation cooldown between frames can be done using a thread function with the wait command?
Thanks, glad it helped! I'm not sure, I haven't tried that but I've always used either a counter variable that I increase at each iteration or just measure the time since the last update.
@@Endermens_Nikos No, i meant using a thread function that increases the frame number. i paste a part of code here so you can understand what i mean: class Player: in constructor i define: self.thread_cd = threading.Thread(target = self.thread_cooldown) then in update method: #K_RIGHT if (key[pygame.K_RIGHT]) and self.pressed_KRIGHT == False: self.animation = True try: self.thread_cd.start() except: self.frame = 0 self.pressed_KRIGHT = True elif not (key[pygame.K_RIGHT]): self.pressed_KRIGHT = False #Immagine if self.animation: screen.blit(self.frame_list[self.frame], (self.rect.x, self.rect.y)) else: screen.blit(self.frame_list[0], (self.rect.x, self.rect.y)) self.frame = 0 thread function: def thread_cooldown(self): while True: wait(40) self.frame = self.frame + 1 if self.frame >= len(self.frame_list): self.frame = 0 self.animation = False Probably the code made by Russ is way better than mine but i wanted to try to use a thread function and it actually works.
thanks for the video! when I add the update animation part it still only shows me the first frame and doesnt iteratethrough the range but when i tested intitally with the for loop all four frames showed up any idea where im going wrong?
I'm really stuck after undertaking the udmey course (which is fantastic by the way), watching your 2d fighter video and this..... no one seems to cover all alternative animation types. By this I mean, we seen how to extract individual sprites from a large sprite sheet and animate, we've seen how to animate individual sprites... if their with a set number of sprites i.e all sprites only have 4 frames or varied number as this video shows via sprite sheet. But how do we animate sprites for example we have multiple states, i.e Idle, walk, run, attack 1, attack 2 and each state has like 20 individual frames..... another has 24 individual frames etc... How do we code the animation for these type of sprites? Any help is greatly appreciated.
Hello, I did something like this in my street fighter game. There I had multiple animation types with different numbers of frames. I combined them all into one larger spritesheet using GIMP and then in pygame extracted the different numbers of frames for each animation. This is the link, you can skip through to the part that you need about animation: th-cam.com/video/s5bd9KMSSW4/w-d-xo.html . Hope this helps!
@@CodingWithRuss thanks for response. Yea, problem I ha e it's hard to sometimes combine the sprites together and equally proptioned. Must be a guide how to do it with individual sprites and not just sheets all the time?
And it's always fun to hear from the original creator :) I really liked these dino sprites, I even started making a side scroller with them at one point but just never got to finish it.
Hay Russ, first off fantastic tutorials! I am following along trying to create a fairy version for my daughter. However, I am having problems with the collisions with my rectangle, I think it is covering the whole picture frame and not just the image inside. How do I fix this problem?
Thanks, I'm glad you like them. It's hard to explain collision in a comment, but if you use ".get_rect()" on an image it will return a rectangle that covers the whole picture frame as you said. Instead you can manually define a rectangle and give it a size that is more suitable with pygame.Rect(). Hope that helps.
hi, this is brilliant, but a random bug popped up that basiccally gives it a permanent afterimage, so to speak. this is an old tutoral, but please help
Love how in depth you are explaining this
OH MY GOD. I HAVE BEEN SEARCHING FOR THIS FOR MONTHS! THANK YOU TO THE BOTTOM OF MY HEART!
Glad I could help :)
Hey Russ I just picked up pygame this week and was in desperate need for beginner tutorials, especially animation. You do a great job with these I appreciate it! Much love ❤️
Awesome, thank you! Glad the videos helped 🙂
Super helpful! I just started using pygame today and I'm already so excited about what I can do with it. Thank you so much for this video!
Glad you liked it and good luck with pygame :)
How did a 70-views video show up in my recommended?
Anyways, I'm glad it did! Even though it's not something I was looking for right now it definitely was still interesting and something I'm looking forward to add to my little game! Thanks!
Glad to hear youtube recommendations got it right :)
I believe in in a saying that, "even the smallest friends can help the biggest." not sure if my spelling is correct, nor the analogy. but hope you understand what I mean.
8:32 in this situation you can write in blit: animation_list[frame%animation_steps]
For example
Awesome! It was very helpful, thank you Russ.
Dude, your such a fucking G for making this tutorial, I can't wait for my game to be fully coded, with physics and shit.
Haha thanks! Good luck with your game.
Hey , I was on the Third video of your Shooter game. I was a bit confused with Sprites and wanted to watch one video wholly dedicated on it. But I couldn't find the perfect one. What a great Timing. Thank you for Uploading this, I'm gonna watch this first and then Continue the shooter game.
You contents are DOPE 💥💥.I would love to watch you making a car game with pygame.
Thanks
Thanks! Good timing :) I plan to make some more of these tutorials which focus on specific tasks like animation, collision etc. After that I will go back to making full game tutorials again
Great job with these tutorials, thanks!
No problem! Glad you found them useful.
Very helpful. Now I have to figure out how to do this with a grid sprite sheet.
just add a 'y' multiplier too similar to frame*width do, frame*height
I really like the way you teaching us ❤❤ tq for all of your efforts puting on the video for us👍👍👍
Thank you, glad to hear it.
Thank you Russ, that was awesome.
Glad you liked it
you deserve way more views....anyway, thanks a lot for your tutorials
Thanks, glad you like them
Im counting on u ;-; You will be de best PyTH-camr
Note: It was my word
Thanks! :)
@@CodingWithRuss Np :)
Super helpful! Thank you so much :)
Thanks for making this video!
You're welcome! Glad it was useful.
Thanks this helped a lot!
Glad you liked it!
how do you then store this animation code in a player class, to then be able to bind it to "player" and be able to move in the x and y?
I've done that in a few of my games, check out the shooter tutorial as that uses a few animations for the player: th-cam.com/video/DHgj5jhMJKg/w-d-xo.html
i use this for 8 directional movement and more, but 4 images in each step and 8 in an animation to spin around and if i move while on a frame above 4 i get error and crash because move images are 1-4
Please I need your help! How can I put the animation in a rectangle??
Thanks that's really clear and very instructive. But what's the advantages of having a sprite in one big file instead of multiple files that we can just load and not bother with all the positioning part ?
It can sometimes be limited to the sprites that you are using, unless you make your own assets. When you get 3rd party asset packs, they are often arranged in spritesheets that you then need to extract your images from.
Hi Russ, thanks for your tutorial video, now i'll screw up less)
No problem! Glad it helped :)
how could you make it so, if you press a key to play the animation it'll only once until you click that key again?
Hey Russ! May I ask what should I do with multiple spritesheets? I have one for idle animation and one for running but I don't want to merge them together. This is a 5 month old video so I guess you'll never respond but I'll put it out anyway. I appreciate your video though! Great tutorial.
did you ever figure it out :()
@@sontoby7309 if I remember correctly, I did solve it by making the sprite rendering part into a separate function that takes in spritesheets. But again, it’s a 2-year-old issue, so don’t expect a good answer from me.
@@BlyatifulButter i managed to do it, i just had to do multiple loops and append the temp list to the larger list multiple times
@@sontoby7309 good job! Sounds like you can make it cleaner with a recursive function, but if it works, it works alright.
Such a great tutorial! How long you been developing games?
Thank you! I've been working with pygame on and off for a couple years now
@@CodingWithRuss Just curious, do you dev games for a living?
@@JohnnyGrateful No, not at all, it's just a hobby!
@@CodingWithRuss Cool, its my new favorite hobby! thanks for the help
does this not work when you have seperate sprite sheets for different actions? ive really been trying to get this to work but cant
Hi russ, thank you for tutorial, it really helped me, but I have a question: do you think the animation cooldown between frames can be done using a thread function with the wait command?
Thanks, glad it helped! I'm not sure, I haven't tried that but I've always used either a counter variable that I increase at each iteration or just measure the time since the last update.
if you meant returning to the animation after you stop pressing the keys, then I did something similar.
I can send the code from the video with the rollback timer to the animation.
@@Endermens_Nikos No, i meant using a thread function that increases the frame number. i paste a part of code here so you can understand what i mean:
class Player:
in constructor i define:
self.thread_cd = threading.Thread(target = self.thread_cooldown)
then in update method:
#K_RIGHT
if (key[pygame.K_RIGHT]) and self.pressed_KRIGHT == False:
self.animation = True
try:
self.thread_cd.start()
except:
self.frame = 0
self.pressed_KRIGHT = True
elif not (key[pygame.K_RIGHT]):
self.pressed_KRIGHT = False
#Immagine
if self.animation:
screen.blit(self.frame_list[self.frame], (self.rect.x, self.rect.y))
else:
screen.blit(self.frame_list[0], (self.rect.x, self.rect.y))
self.frame = 0
thread function:
def thread_cooldown(self):
while True:
wait(40)
self.frame = self.frame + 1
if self.frame >= len(self.frame_list):
self.frame = 0
self.animation = False
Probably the code made by Russ is way better than mine but i wanted to try to use a thread function and it actually works.
thanks for the video! when I add the update animation part it still only shows me the first frame and doesnt iteratethrough the range but when i tested intitally with the for loop all four frames showed up any idea where im going wrong?
Same thing is happening to me. Did you fix it? If so, how?
Could someone have another animation on a different sprite sheet? for example one sprite sheet for idle one for running etc
I'm really stuck after undertaking the udmey course (which is fantastic by the way), watching your 2d fighter video and this..... no one seems to cover all alternative animation types. By this I mean, we seen how to extract individual sprites from a large sprite sheet and animate, we've seen how to animate individual sprites... if their with a set number of sprites i.e all sprites only have 4 frames or varied number as this video shows via sprite sheet. But how do we animate sprites for example we have multiple states, i.e Idle, walk, run, attack 1, attack 2 and each state has like 20 individual frames..... another has 24 individual frames etc... How do we code the animation for these type of sprites? Any help is greatly appreciated.
Hello, I did something like this in my street fighter game. There I had multiple animation types with different numbers of frames. I combined them all into one larger spritesheet using GIMP and then in pygame extracted the different numbers of frames for each animation. This is the link, you can skip through to the part that you need about animation: th-cam.com/video/s5bd9KMSSW4/w-d-xo.html . Hope this helps!
@@CodingWithRuss thanks for response. Yea, problem I ha e it's hard to sometimes combine the sprites together and equally proptioned. Must be a guide how to do it with individual sprites and not just sheets all the time?
It is always fun to see my sprites in other peoples content.
And it's always fun to hear from the original creator :) I really liked these dino sprites, I even started making a side scroller with them at one point but just never got to finish it.
Hay Russ, first off fantastic tutorials! I am following along trying to create a fairy version for my daughter. However, I am having problems with the collisions with my rectangle, I think it is covering the whole picture frame and not just the image inside. How do I fix this problem?
Thanks, I'm glad you like them. It's hard to explain collision in a comment, but if you use ".get_rect()" on an image it will return a rectangle that covers the whole picture frame as you said. Instead you can manually define a rectangle and give it a size that is more suitable with pygame.Rect(). Hope that helps.
hi, this is brilliant, but a random bug popped up that basiccally gives it a permanent afterimage, so to speak. this is an old tutoral, but please help
WHERE IS THE LINK TO FIRST TUTORIAL?
Hi Russ, I want to randomize two things like apple and banana in my snake game but I couldn't find proper solution. Can you please help me.
Im also a beginner but could you not just import random and then use random.choice( "banana.png","apple.png")
Whan I load image they say no such file or directory found
I am using pycharm
Problem fixed
weirdly enough mine didnt work until i changed the "if frame >= len(animation_list): to "if frame >= len(temp_image_list)
nevermind, i read ahead. had to add the animation_list[action] portion. im a dingus. hope this helps someone else
i feel like this could be a optomized. Try making it bit better
cool
Thanks!
@@CodingWithRuss this is not cold, so how come you are saying it's cool?
This dos not even work for me
Make more games in pygame
look at his channel he has so many
i think you method is too dificult
🧑💻