Python / Pygame Tutorial: Animations with sprites

Поделиться
HTML-код
  • Опубликовано: 2 июн 2024
  • A tutorial about how to use sprites to create an animation on a button press and also how to control the speed of the animation, all happening in the Python module Pygame.
    Project files can be found here: github.com/clear-code-project...
    Basic tutorial on sprites: • Python / Pygame Tutori...
    Assets I used: opengameart.org/content/opp20...
    Link to the image in the logo: pixelartmaker.com/art/7b0362cb...

Комментарии • 168

  • @dipalzambare9257
    @dipalzambare9257 3 года назад +61

    Absolutely genius way to handle animation speed, short and efficient.

  • @reapercreeper6097
    @reapercreeper6097 2 года назад +4

    the way you handled animation speed is just the best in my opinion,i was struggling with that but thanks to you i got it

  • @pierrebenkiran212
    @pierrebenkiran212 4 года назад +4

    Hey, thank you so much for your video!
    I have started to learn pygame a week ago and I am currently working on a game. This video helped me a lot and you explain everything in a very good way!
    Thank you!

  • @hariharanthegreat5576
    @hariharanthegreat5576 3 года назад +48

    2:46
    Here, you can make a for loop which can loop through the name like:
    for i in range(1, 11):
    path_name = "attack_"+str(i)+".png"
    image = pygame.image.load(path_name)
    self.sprites.append(image)
    If you are working with a lot of images, this may help

    • @theyoutubeaccount8499
      @theyoutubeaccount8499 3 года назад +17

      You can use f strings:
      for i in range(1, 11):
      image = pygame.image.load(f"attack_{i}.png")
      self.sprites.append(image)

    • @doppler110
      @doppler110 2 года назад +5

      If you are working on a lot of images, is convenient having a spritesheet.

    • @omegalevelmutant
      @omegalevelmutant 2 года назад +11

      You can also use a list comprehension as short hand for the for-loop.
      self.sprites = [pygame.image.load(f"attack_{i + 1}.png") for i in range(10)]

    • @0rd3r
      @0rd3r Год назад +1

      @@theyoutubeaccount8499 or format mthod
      for i in range(1, 11):
      image = pygame.image.load("attack_{}.png".format(i))
      self.sprites.append(image)

    • @flames9310
      @flames9310 Год назад +2

      @@0rd3r you're absolutely right but people generally prefer f strings as f strings are usually more convinient--especially when you have to use a lot of formatting--since you can manually place the variables where you want them to be instead of using the respectively logic.

  • @abd-y5011
    @abd-y5011 3 года назад +13

    Finally, I found it, you are the best. Thank you sooooooo much.

  • @user-tt1hd7ht1r
    @user-tt1hd7ht1r 8 месяцев назад

    This is the best pygame animation tutorial on RUclips.

  • @EpicGamer-ux1tu
    @EpicGamer-ux1tu Год назад +1

    Amazing video! Really useful descriptions of everything and a great explanation too. Thank you very much!

  • @youtuberecommended9183
    @youtuberecommended9183 4 года назад +2

    Videos keep getting better!

  • @khalilatay8058
    @khalilatay8058 Год назад

    IDK why this video shows now for me after 2 years of uploading but this is great thing
    He helped me

  • @Neverchangefornew
    @Neverchangefornew Год назад +1

    In this video, your code is easy to use so it will help me make my own game better. Thank you !😊

  • @constantinbaclanov4857
    @constantinbaclanov4857 3 месяца назад

    Like your programming stile! Keep it up!

  • @Mike-zj6mp
    @Mike-zj6mp Год назад

    TYSM! You have helped me with lots of problems in pygame!

  • @jleonardolemos
    @jleonardolemos 2 года назад

    The animation speed was my main convern, thanks!!!!!

  • @marcellodelfiore1361
    @marcellodelfiore1361 Год назад

    This tutorial was really helpful, thank you so much :D

  • @baptistegogolewski5049
    @baptistegogolewski5049 3 года назад +6

    hey ! i'm french and i find that you explain very good. You speak slowly and your vocabulary is simple !
    i don't understand why you don't continute videos.

    • @volath7655
      @volath7655 2 года назад

      i'm french too and i agree with that

  • @cheeseisnice101
    @cheeseisnice101 3 года назад +3

    Thanks for the tutorial, it helped me a lot.
    Finally know how to make a proper animation!
    I suggest one simple improvement to the code (got it from stackoverflow):
    When you load all the images for the animation, you use one line of code for each images (in the Player class).
    You could do this instead:
    for filename in os.listdir(folder):
    img = pygame.image.load(os.path.join(folder,filename))
    if img is not None:
    images.append(img)
    The only thing you need to do is assing the directory of the folder with all the images in it.
    It will automaticly store all those images in a list.
    I think that this is a little more robust, because if you want to change the animation you don't need to change the code.
    (keep in mind that the order of those images in that folder are important)

  • @JayeshSarvaiya
    @JayeshSarvaiya 3 года назад

    Wonderful stuff !!! Thank you so much for theses videos.

  • @KenekeBiggs
    @KenekeBiggs 2 года назад

    I hacked this one time using PowerPoint: by copying instances of a single image, then working with the “appear” animated effect and the time of appearance and disappearance, then setting object in front of each other corresponding with animation I would make things blip across the screen lol ... that was my little hack.
    Now I’m trying to understand this lol it’s taking some time. I just started learning like a week ago. Thank you for your tutorial.

  • @kazishahjalal6852
    @kazishahjalal6852 2 месяца назад

    Thanks a lot. I have successfully created my own animation of Goku using your help.

  • @leonibus5447
    @leonibus5447 4 года назад

    thanks for the video, this was something i wanted to know how to do.

  • @timsim83
    @timsim83 Год назад

    Sprite Groups! I needed this! Thank you!

  • @cadencoronado9726
    @cadencoronado9726 Год назад

    very clever fix for the animation speed

  • @TheRodrigoExp
    @TheRodrigoExp 4 года назад

    This saved me!! Thanks, awesome video!

  • @VNeseIT
    @VNeseIT Год назад

    Bro your tutorial is so cool!!!

  • @marinehottelet161
    @marinehottelet161 3 года назад +1

    This is amazing, thank you :)

  • @samuelbarton4991
    @samuelbarton4991 2 года назад

    awesome man, very helpful!

  • @tulsiroy8631
    @tulsiroy8631 3 года назад

    You deserve million subs

  • @yutdevmahmoud5271
    @yutdevmahmoud5271 2 года назад

    Thank you man great video

  • @Thahid
    @Thahid 2 года назад

    Excellent tutorial 👍🏽

  • @cyber_hawk0925
    @cyber_hawk0925 3 года назад

    Very useful! Thank you so much!!!

  • @geetmala311
    @geetmala311 2 года назад

    Thank you so much for this useful information

  • @CommonNoun9
    @CommonNoun9 3 года назад

    The way you slowed down the animation, that was really cool, I am so glad I could find your channel

  • @miedorama
    @miedorama 2 года назад

    what a wonderful coding!

  • @MaRCosWaRLoCk02
    @MaRCosWaRLoCk02 3 года назад

    Thank you sooooooo much. You save my week

  • @johnleeroberts
    @johnleeroberts 3 года назад +1

    Is it necessary to use self. for variables that will not be accessed from outside a class? For example, in your Player class, you create a self.is_animating boolean attribute. Could you just use is_animating instead?

  • @flipperyeti394
    @flipperyeti394 4 года назад +17

    That's cool man. Idk why you only have 30 likes, keep going 😊

  • @Quantramix
    @Quantramix 2 года назад +2

    how to make the back ground of the frog transparent so that it can be anywhere like the beginning of the vid and how to just let it automatically do action after a particular time

  • @seifnajeh9525
    @seifnajeh9525 3 года назад

    Thank you ! this was awsome

  • @droidgenetx
    @droidgenetx 3 года назад

    that's clever using int() to space out the frames

  • @SenseiPlus
    @SenseiPlus Год назад

    It's beautiful to see how you explain, I don't understand English, even so it is perfectly understood.
    It would be great if you made the videos explained in Spanish. That way it would be much easier to understand for the Spanish-speaking public.
    And your audience would grow much more.
    MUCHAS GRACIAS TU VIDEO ESTA GENIAL!!!

  • @AryanSingh11
    @AryanSingh11 3 года назад +3

    Damm .. I thank RUclips , I saw this video in my recommendations .. Tried Searching this stuff

  • @MiniDonpach
    @MiniDonpach 2 года назад

    Thanks for the video!

  • @Vivek-qc8qo
    @Vivek-qc8qo 7 месяцев назад

    for slowing down , i implemented a counter , that will count back till 10 one by one on each frame, after that update the sprite , and update itself back to 10 , simplest method that i developed myself

  • @aadarshkumarshah8795
    @aadarshkumarshah8795 2 года назад +1

    Make more videos, you have no idea how much you are contributing to beginners

  • @teamprolife7341
    @teamprolife7341 2 года назад

    good job! Thank you!

  • @ChannelMovies
    @ChannelMovies 3 года назад

    It's amazing 👍

  • @hemantbisht5630
    @hemantbisht5630 2 года назад +1

    like in the code , you use screen.fill((0,0,0))
    but i don't want to fill the screen black , i want the background image in my game to remain same while running the animation

  • @aadityabhetuwal5990
    @aadityabhetuwal5990 3 года назад

    Awsome tutorial

  • @hillarymapondera4122
    @hillarymapondera4122 3 года назад +1

    Amazing this is super cool I enjoyed following along with the programming, however, my simulation seems to overlap images and not clearing the previous image why could this be the case ?

    • @ClearCode
      @ClearCode  3 года назад +1

      you need to add a background to the entire game otherwise you can always see the previous drawn frames.

  • @jacrox
    @jacrox 2 года назад

    Instead of using an if statement, would it be better to use the modulo operator to keep the current_sprite number under the max index length?

    • @goldenbananas1389
      @goldenbananas1389 Год назад

      yes but the if statment serves to not just limit the current sprite number but also serves to end the animation

  • @peschebichsu
    @peschebichsu 2 года назад

    Aren't 3d moves made following the same principle? Would be interesting if you made a video about it too

  • @electronicgamer5953
    @electronicgamer5953 3 года назад

    Bro can you tell me if I pressed w it should show one animation with one button one

  • @vaibhavpandey6640
    @vaibhavpandey6640 3 года назад +1

    that frog pixelart was cool where can i get more like this

  • @iandanforth
    @iandanforth 2 года назад

    Note that in this implementation the final frame will display for a shorter period of time than other frames for values of speed < 1.

    • @doldol00d.a.b.32
      @doldol00d.a.b.32 2 года назад

      It simply needs to change >= to >

    • @luigidabro
      @luigidabro Год назад

      You can use
      (animation_insex + 0.15) % length
      Like this it would be lossless

  • @ech0_exe243
    @ech0_exe243 4 года назад +1

    Hey, this video was really good. I kept searching till I could find something like this
    lol 2 years later i see this comment lmao

    • @ClearCode
      @ClearCode  4 года назад +1

      Thank you very much

    • @ech0_exe243
      @ech0_exe243 4 года назад

      @@ClearCode I have a question. The website u got it from was the pictures in a sprite sheet or separate images.

    • @ech0_exe243
      @ech0_exe243 4 года назад

      also if I make my own sprit sheet how does it cycle through the different images if they are all in the same sheet.

    • @ClearCode
      @ClearCode  4 года назад

      @@ech0_exe243 you would basically have to cut out a specific part of that sprite sheet and store it on its own surface. There are lots of other pygame sprite sheet tutorials, most of them use that approach actually. But it is rather tedious, I'm afraid.

    • @ech0_exe243
      @ech0_exe243 4 года назад

      @@ClearCode alright thank you! Im just starting animating for my game.

  • @atif9020
    @atif9020 13 дней назад

    we can use:
    for i in range(1,10):
    self.sprite.append(pygame.image.load(f"attack_{i}.png"))
    instead of repeating the same line...btw video was very helpful

  • @rz41S
    @rz41S 2 года назад

    Nice!

  • @CloudlessStudio
    @CloudlessStudio Год назад

    im new to OOP, can you tell me why animate() is called on player.animate() and not like this: moving_sprites.animate()?

  • @justinnhleko3612
    @justinnhleko3612 3 года назад

    Thank you so much

  • @Derpy999
    @Derpy999 2 года назад +1

    Yes this is a good video but you have any idea how to move the sprites on WASD events?

    • @Acradus
      @Acradus Год назад

      Amateur here, hopefully you got this after a year, but wouldn’t it just be
      while keyinput(or whatever pygame uses for this) == true:
      Proceed through the animating process with all that code from the video of the for loop?

    • @Derpy999
      @Derpy999 Год назад

      @@Acradus lol i did get this after a yer, thanks though

  • @louzynerd129
    @louzynerd129 3 года назад +1

    question, i'm making a character and it can move right and left , it can also jump but when i stand still it freezes on one image even though i have 4 sprites for standing still, but it's not going through them, how can i add your method so that when i don't press anything it goes through the 4 sprites of the (still) variable in my code? here is the code if you want to see:
    import pygame
    pygame.init()
    Width = 1024
    Height = 224
    win = pygame.display.set_mode((Width, Height))
    bg = pygame.image.load('bg.png')
    pygame.display.set_caption("A game")
    icon = pygame.image.load('icon.png')
    pygame.display.set_icon(icon)
    walkRight = [pygame.image.load('right 1.png'), pygame.image.load('right 2.png'), pygame.image.load('right 3.png'),
    pygame.image.load('right 4.png'), pygame.image.load('right 5.png'), pygame.image.load('right 6.png'),
    pygame.image.load('right 7.png'), pygame.image.load('right 8.png'), pygame.image.load('right 9.png'),
    pygame.image.load('right 10.png'), pygame.image.load('right 11.png'), pygame.image.load('right 12.png')]
    walkLeft = [pygame.image.load('left 1.png'), pygame.image.load('left 2.png'), pygame.image.load('left 3.png'),
    pygame.image.load('left 4.png'), pygame.image.load('left 5.png'), pygame.image.load('left 6.png'),
    pygame.image.load('left 7.png'), pygame.image.load('left 8.png'), pygame.image.load('left 9.png'),
    pygame.image.load('left 10.png'), pygame.image.load('left 11.png'), pygame.image.load('left 12.png')]
    still = [pygame.image.load('standing 1.png'), pygame.image.load('standing 2.png'), pygame.image.load('standing 3.png'),
    pygame.image.load('standing 4.png')]
    baseLeft = pygame.image.load('enemy base facing left.png')
    baseRight = pygame.image.load('enemy base facing right.png')
    clock = pygame.time.Clock()
    class Player(object):
    def __init__(self, x, y, width, height):
    self.x = x
    self.y = y
    self.width = width
    self.height = height
    self.vel = 5
    self.isJump = False
    self.jumpCount = 10
    self.left = False
    self.right = False
    self.walkCount = 0
    def draw(self, win):
    if self.walkCount + 1 >= 36:
    self.walkCount = 0
    if self.left:
    win.blit(walkLeft[self.walkCount // 3], (self.x, self.y))
    self.walkCount += 1
    elif self.right:
    win.blit(walkRight[self.walkCount // 3], (self.x, self.y))
    self.walkCount += 1
    else:
    win.blit(still[self.walkCount // 3], (self.x, self.y))
    def redraw_game_window(): # anything to change for drawing is here
    win.blit(bg, (0, 0))
    soldier.draw(win)
    win.blit(baseRight, (924, 110))
    win.blit(baseLeft, (72, 110))
    pygame.display.update()
    # main loop for game
    soldier = Player(200, 110, 64, 80)
    run = True
    while run:
    clock.tick(50)
    for event in pygame.event.get():
    if event.type == pygame.QUIT:
    run = False
    keys = pygame.key.get_pressed()
    if keys[pygame.K_LEFT] and soldier.x > soldier.vel:
    soldier.x -= soldier.vel
    soldier.left = True
    soldier.right = False
    elif keys[pygame.K_RIGHT] and soldier.x < 1024 - soldier.width - soldier.vel:
    soldier.x += soldier.vel
    soldier.right = True
    soldier.left = False
    else:
    soldier.right = False
    soldier.left = False
    soldier.walkCount = 0
    if not (soldier.isJump):
    if keys[pygame.K_SPACE]:
    soldier.isJump = True
    soldier.right = False
    soldier.left = False
    soldier.walkCount = 0
    else:
    if soldier.jumpCount >= -10:
    neg = 1
    if soldier.jumpCount < 0:
    neg = -1
    soldier.y -= (soldier.jumpCount ** 2) * 0.26 * neg # ** double
    soldier.jumpCount -= 1
    else:
    soldier.isJump = False
    soldier.jumpCount = 10
    redraw_game_window()
    pygame.quit()

    • @edwinfragiel8907
      @edwinfragiel8907 3 года назад

      Well, I never try to make standing animations, but I think you can try to make a for loop who goes from 0 to less than 4 (number of your animation sprites) to keep scrolling the animation while your character is not in moving

  • @veljavracarevic6626
    @veljavracarevic6626 4 года назад +1

    Great job, this helped me a lot for understanding basics of pygame but my pictures wont open, do you have any clue what could be problem?

    • @ClearCode
      @ClearCode  4 года назад

      Hey, do you have the pictures in the same folder as the script? Do you get an error message?

    • @veljavracarevic6626
      @veljavracarevic6626 4 года назад

      @@ClearCode No they arent and yes an error message pops up.

    • @veljavracarevic6626
      @veljavracarevic6626 4 года назад

      @@ClearCode no they arent in same folder and yes i see error message

    • @ClearCode
      @ClearCode  4 года назад

      @@veljavracarevic6626 that is probably the problem then. If that doesn't work, what's the error message?

    • @veljavracarevic6626
      @veljavracarevic6626 4 года назад

      @@ClearCode sorry for so many replies. I wrote so many since when I was checking they weren't popping up. Anyways thanks for advice it worked. Keep up good work.

  • @vortigaunt1494
    @vortigaunt1494 2 года назад

    NIIIIIIIIIIIIICEEE BRO

  • @pmemoli9299
    @pmemoli9299 3 года назад

    thaaaank you! Could you please make a tutorial on good practice for modularizing code in pygame? It would be insanely helpful and I haven't seen any tutorials on the subject. Your work is insanely good.

    • @ClearCode
      @ClearCode  3 года назад +3

      that comes next Wednesday actually :)

    • @pmemoli9299
      @pmemoli9299 3 года назад

      @@ClearCode

    • @ClearCode
      @ClearCode  3 года назад +1

      @@tiran315 It will come soon! sorry

  • @PhycoSerpentStudios
    @PhycoSerpentStudios 2 года назад

    This is really confusing for what I'm trying to do :/
    I'm making a top down game that updates the sprite based on the button that's pressed at the current moment and this code conflicts with that.
    Could you make a video with a tutorial that plays an animation on the sprite during an event, rather than changing the sprite itself?
    Like a death event that plays an explosion on a spaceship, or a shooting event that shows a fire/explode animation that comes out of a weapon?

    • @emperor8716
      @emperor8716 Год назад

      this doesn't conflict with any of that. use the concept to write the code yourself.

  • @venusoutergalaxy
    @venusoutergalaxy Год назад +1

    Please tell how to add animated gifs to pygame

  • @nvudo4043
    @nvudo4043 Год назад

    thank you

  • @XxCrazyMix123
    @XxCrazyMix123 3 года назад

    Great video but now how would we move the x and y position of that?

    • @ClearCode
      @ClearCode  3 года назад

      just change the values for self.rect to whatever you need, this is not going to affect the animation

  • @zeperoxx
    @zeperoxx 3 года назад

    That's a cool tutorial, but is there a way to have some sprites going faster than others?
    Like sprite 1 stays for 4 frames and sprite 2 stays for 7 frames

    • @ClearCode
      @ClearCode  3 года назад +2

      you have a list of sprites, just copy the one you want to have multiply times a few times. Bit of a hack but should work well :)

  • @BatCode.
    @BatCode. 2 месяца назад

    Can i get the link of your music you using in this video?

  • @user-ng4bc3cv6g
    @user-ng4bc3cv6g 3 года назад +2

    3:10
    Can we instead do ?:
    For x in range(11): self.sprites.append(pygame.image.load(f"attack_{x}.png"))

    • @ClearCode
      @ClearCode  3 года назад +1

      yes, should be fine

    • @user-ng4bc3cv6g
      @user-ng4bc3cv6g 3 года назад +1

      Just forgot something b4 the appends
      If x != 0:

    • @ClearCode
      @ClearCode  3 года назад +1

      @@user-ng4bc3cv6g I should have said: Yes, that should work in theory :)

    • @user-ng4bc3cv6g
      @user-ng4bc3cv6g 3 года назад +1

      @@ClearCode :)

  • @prajyotp7991
    @prajyotp7991 2 года назад

    hello! i am having a problem with my code where its saying AttributeError: 'str' object has no attribute 'get_rect' do you maybe know how to fix this?

    • @prajyotp7991
      @prajyotp7991 2 года назад

      nvm i fixed it i was just using os instead of pygame.image.load

  • @vaibhavkrkm
    @vaibhavkrkm 3 года назад

    Cool!

  • @kaiiiii5812
    @kaiiiii5812 Год назад

    I downloaded the code and run it in vscode, what happened is there's no animation on the sprite. Can anyone tell me how to fix this.

  • @shroomadelics
    @shroomadelics Год назад

    Hey another great tut:)
    I downloaded some sheets and cutted them in single PNGs. They are 250x250 but the figure on it is only 70x70 so when i load in pygame and do get.rect() i always get the 250x250…

    • @blankblank1273
      @blankblank1273 Год назад +1

      Coding with russ has a good tutorial on how to use spritesheets. It'll solve your problem

    • @shroomadelics
      @shroomadelics Год назад

      @@blankblank1273 ok thank you will check it out:)

  • @catlat3606
    @catlat3606 2 года назад

    How do I increase the size of the frogs? I tried using these codes below but it didnt seem to work.
    """
    self.current_sprite = 0
    self.image = self.sprites[self.current_sprite]
    self.image = pygame.transform.scale(self.image(300,300))
    self.rect = self.image.get_rect(topleft = (pos_x,pos_y))
    """

    • @user-fv6ws7nc4u
      @user-fv6ws7nc4u 2 года назад

      i have the same problem, did you managed to figure out what it was?

  • @Paul-ly1pw
    @Paul-ly1pw Год назад

    My frogs are a bit small. How could I make them bigger?

  • @chrisandrade2425
    @chrisandrade2425 Год назад

    Ok. Yes. This was straight forward. Super helpful for my first time using class. HOW DO YOU ROTATE THE FROG TO LOOK DOWN WHEN YOU PREES K_s!?!?

  • @AlexanderWhillas
    @AlexanderWhillas Год назад

    This is niec and simple, maybe too simple as this is not going to scale to large numbers of animations and sprites. I was hoping for something beyond the basics of playing animation is a fixed linear time i.e. easing functions etc

  • @wiebrenstroop5731
    @wiebrenstroop5731 2 года назад

    I changed the Payer __init__ method a bit :
    self.images = ['attack_1','attack_2','attack_3','attack_4','attack_5',
    'attack_6','attack_7','attack_8','attack_9','attack_10']
    self.sprites = [pygame.image.load(frog+'.png') for frog in self.images ]
    self.attack_animation = False
    self.current_sprite = 0
    self.image = self.sprites[self.current_sprite]
    self.rect = self.image.get_rect()
    self.rect.topleft = [pos_x,pos_y]

  • @indiancuber1086
    @indiancuber1086 3 года назад

    Can u add the Seperate PNG's in the asset files please..

    • @ClearCode
      @ClearCode  3 года назад

      hey so sorry for forgetting, added the link to the description now (github.com/clear-code-projects/animation)

  • @vaibhavpandey6640
    @vaibhavpandey6640 3 года назад

    please make a video on aniamtion via. spritesheets

  • @randomboi550
    @randomboi550 Год назад

    Where can I contact you?
    I am a student who is making a game. I need to have an interview with an expert in the field and I think you are a good choice.
    I also need a little help in the game I am making so in the interview I will be making some queries.
    ,Thankyou

  • @kewtomrao
    @kewtomrao 3 года назад +2

    For my ref : Every frame we change the sprite image.But we want to reduce the speed ie after 5 frames we want to change the image to the next animation image,hence we need to increment by 1/5 = 0.2 every frame.

  • @albertodelavera9802
    @albertodelavera9802 Год назад

    Hi, ii used to aply :
    current-image +=1
    current_image%=number_of_pictures
    So it could be more efficient

  • @lfumeto2269
    @lfumeto2269 3 года назад

  • @electronicgamer5953
    @electronicgamer5953 3 года назад

    Move to 7:49 to see button press animation

  • @plesnivyjabkod9897
    @plesnivyjabkod9897 9 месяцев назад

    But you are not able to make animation faster this way, cause you are losing sprites. If you set speed =2, you show just 1, 3, 5 , 7, 9 sprites (or 0,2 ,4 ,6 ,8)... ????

  • @AnimatingChannel
    @AnimatingChannel 8 месяцев назад

    "Player" object has no attribute "image"

  • @jacksonromel4161
    @jacksonromel4161 4 года назад +2

    even though I don't understand much English, I was able to follow along, thank you for your teaching.
    could teach how to move character + map the same in game as Zelda - A link to The past.?

    • @ClearCode
      @ClearCode  4 года назад +1

      Hey, glad you liked it. And a zelda style tutorial is in the works, but I have some other things planned first, so it's gonna take a week or two

    • @jacksonromel4161
      @jacksonromel4161 4 года назад +1

      Thanks, I will follow and wait.

  • @ItsBlazeMC69
    @ItsBlazeMC69 11 месяцев назад +2

    hey can you make a tutorial on flipping the player based on their movements? what it means is that lets say I put
    if key[pygame.K_a]:
    hope you understand this cause I am having a hard time trying to explain this

  • @MonkeyDLuffy-ld5iy
    @MonkeyDLuffy-ld5iy 3 года назад +1

    I want this without filling background black

    • @ClearCode
      @ClearCode  3 года назад +1

      just change screen.fill(0,0,0) to any other rgb value and you can choose just about any color

    • @MonkeyDLuffy-ld5iy
      @MonkeyDLuffy-ld5iy 3 года назад

      @@ClearCode I know that but I don't want that. I have solved it Thx

  • @kurbonmirzoaliev9600
    @kurbonmirzoaliev9600 2 года назад

    what da frog doin

  • @yavarjn2055
    @yavarjn2055 2 года назад

    This absolutely abolishes the idea of an sprite sheet. The idea is to have all the animations in one file so that you dont have to load 10 files and then iterate through them.

  • @tcgvsocg1458
    @tcgvsocg1458 3 года назад

    Nope that doesnt work for me

  • @rz41S
    @rz41S 2 года назад

    10:17

  • @captainneb23
    @captainneb23 Год назад

    Pygame and pycharm are the same thing

  • @DevAnand-jb7id
    @DevAnand-jb7id 2 года назад +1

    Really too clear with a peace voice and background.

  • @joaopedromedeirosrodrigues4863
    @joaopedromedeirosrodrigues4863 3 года назад

    Por que aqui só tem comentários br? kkkk

    • @orlok6984
      @orlok6984 2 года назад

      Ta moscando jão?

  • @telband5314
    @telband5314 3 года назад

    The frog won't appear when i run the code. I put the frog folder with 10 images in VS. Here is my code: pastebin.com/h1wAnqpx

    • @ClearCode
      @ClearCode  3 года назад

      hey, I had a quick look:
      on line 25 you have a typo (it should be self.is_animating instead of self.in_animating)
      on line 32 the if statement needs to be indented
      Didn't have time to test it myself, but I realised that I didn't upload the project files, will upload it in a bit; then you can test it yourself.

    • @telband5314
      @telband5314 3 года назад

      Solved the problem... #drawing had to be on the same line as "for event in pygame.event.get():". Thanks for the quick response anyway :)

    • @ClearCode
      @ClearCode  3 года назад

      @@telband5314 well spotted! Indentations can be so pesky....