PyGame Flappy Bird Beginner Tutorial in Python - PART 1 | Creating a Scrolling Background

Поделиться
HTML-код
  • Опубликовано: 19 ноя 2024

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

  • @akramelomrani8728
    @akramelomrani8728 3 года назад +9

    I absolutly love your pygame video and your series are so good, I am probably going to watch them all

  • @salimen9861
    @salimen9861 3 месяца назад +1

    It's a pleasure to learn with you.

  • @HappyDingDong_
    @HappyDingDong_ 2 месяца назад +3

    You just earned a new subscriber!

  • @yijinkuo0712
    @yijinkuo0712 7 месяцев назад

    Greetings,
    I have read most of the comments and they were wonderful, I respectfully please you use some other values because not everyone has the same screen as yours. This is still amazing, thank you!

  • @jonsantos6056
    @jonsantos6056 3 года назад +5

    Cheers a lot mate for this Flappy Bird game using Pygame.

  • @kofienyimayew
    @kofienyimayew 7 месяцев назад +1

    your video really helped me, I love them.

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

    Hey There! Thank you so much for this video series. It helped me for my school work! Keep it up!!!

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

    Best tutorial ever

  • @marcuschan535
    @marcuschan535 3 года назад +4

    your video is so cool and interesting, like the way you teach lol

  • @arkantrust
    @arkantrust 4 года назад +8

    Hi, great video, I come from reddit

  • @kydung5378
    @kydung5378 4 месяца назад +1

    why is the ground photo in this video long while blit() just draws its position somewhere else??

  • @JesusGines-ne5eq
    @JesusGines-ne5eq 5 месяцев назад

    thanks for coding this game you top shelve

  • @thecomputer1424
    @thecomputer1424 4 месяца назад +2

    I have a confusion when you are decrementing the value of *x-coordinate* of *Ground floor,* then why only hashes moving to left? Why not the entire image?

    • @anshdesai2131
      @anshdesai2131 3 месяца назад +1

      its bc it doesn't delete the previous blits of the ground image it only just places the new blit on top so it basically is showing u the last 4 pixels on the right hand side repeated which kinda make it look like only the slanted line/ hashes move to the left

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

      @@anshdesai2131 Wait let me give you the timestamp.

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

      @@anshdesai21318:06

  • @xoxo.lxly.26
    @xoxo.lxly.26 День назад

    i am using Mac and it says that no found 'pygame'
    Please tell me what to do?

  • @abhipatel4595
    @abhipatel4595 2 месяца назад +1

    I just subscribed!

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

    great game love your videos

  • @가즈아-o4y
    @가즈아-o4y 3 года назад +1

    Thx man, God bless you

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

    thankyou dude love you so much

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

      Glad you liked it!

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

      @@CodingWithRuss I am using this for my school project

  • @BWB_Cubing
    @BWB_Cubing 9 месяцев назад +1

    i cant even use it because when i run it, it fills up the whole screen and i cant even interact with tbhe top bar (the windows bar)
    so i would have to use a different smaller resolution, but then the sprites wont work, so i'd have to somehow resize the sprites, which wont work either because it will mix the colors and just look f*cking sh*tty

    • @pq423
      @pq423 2 месяца назад +1

      go into windows settings > system > display > decrease scale %

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

    Hello!
    5:08 Please i putted the same name same everything for the image and its saying when i run it :
    ( bg = pygame.image.load('img/bg.png')
    FileNotFoundError: No such file or directory.)
    i even checked the name type though
    **ITS saved in downloads and i put it as bg ground and like that ***
    i went to properties and even checked :/
    In pycharm :(, Help thanks

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

      Help 💜

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

      @@YaGirlTech but do you have a folder named img that stores all the images?

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

    This is my first time using PyGame, and I am having trouble with the second line of code in this tutorial. Whenever I type the star at the end of this line it greys out the line of code?

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

      Sound like the editor you're using is doing that. Try sublime text editor instead

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

      even when it greys out it still works i tried it

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

    im such a good programer. Cant even yoink code to make a program work

  • @ijsPod
    @ijsPod 5 месяцев назад

    only shows images for a split second when closing the program. Code indentation seems to be fine, any suggestions?

    • @CodingWithRuss
      @CodingWithRuss  5 месяцев назад

      Try running the source code from the github repo (linked in video description) and see if the same issue happens there. If it works fine then you can compare the code with yours and see if anything stands out.

    • @ijsPod
      @ijsPod 5 месяцев назад

      @@CodingWithRuss Turns out I did overlook the indentation at pygame.display.update(). Thanks a lot for that suggestion!

  • @zayu.11
    @zayu.11 3 года назад +1

    In my line 10 [pygame.dispay.set_caption('Flappy Bird')], i am getting error like such, AttributeError: module 'pygame' has no attribute 'dispay'. Any help?

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

      Did you figure it out? You have a typo - you've put "dispay" instead of "display"

    • @zayu.11
      @zayu.11 3 года назад +1

      @@CodingWithRuss Oh I have not realized, I was going to quit until I saw this 😅. Thank you!(you earend a sub by being a productive creator and interacting with your comments)

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

    i want to ask something.. which folder did you save the images?..

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

      Just create a folder in the same directory as the file of the game and if you are trying to load the images, write pygame.image.load("FILENAMEINSAMEDIRECTORY/IMAGE").

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

      Hi, We can create assets folder and put the images in it. Or we can put the images in the program folder itself, which contains the program data.

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

    thanks for all

  • @pushpakbiswas9852
    @pushpakbiswas9852 11 месяцев назад +1

    If i run in 864 × 936, it is covering most of the sscreen unlike yours and i cannot find the cdoss button. Can you suggest me some other values

    • @Sunrit_Mullick
      @Sunrit_Mullick 6 месяцев назад +1

      import ctypes
      def set_window_position(window_title, x, y):
      hwnd = ctypes.windll.user32.FindWindowW(None, window_title)
      if hwnd != 0:
      ctypes.windll.user32.SetWindowPos(hwnd, 0, x, y, 0, 0, 1)
      # Call this function after creating the Pygame window
      set_window_position('Flappy Bird', 100, 100)
      hopefully this works!

    • @JuiceTeaBeans
      @JuiceTeaBeans 4 месяца назад

      @@Sunrit_Mullick Thank you! This worked for me. It cut off the bottom of the screen still but that doesn't matter since it is a black bar (unless it has value later on?).

    • @Sunrit_Mullick
      @Sunrit_Mullick 4 месяца назад

      @@JuiceTeaBeans you will add a scrolling ground animation later on

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

    Can you make video on how to add levels in it please

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

    cant download ant image from your github resource please help

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

    When I code it does not show me image and says no available video device pls help😢

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

      I haven't seen that error in pygame before! Are you having this error with other pygame projects too? This may be specific to your installation

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

    Really enjoying this tutorial so far, but my second background only scrolls when my mouse is hovering over the screen. I have checked my code and made sure that it's the same as yours. Any solution for this? (Using Python 3 with Windows 10)

    • @tusharkanoi6153
      @tusharkanoi6153 7 месяцев назад

      Same issue have you got the solution ?

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

    it says FileNotFoundError: No file 'img/bg.png' found in working directory

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

      put the file in the same directory as the project

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

      @@slendii366 ok thx for replying 👍

    • @LazyLlamaDrama
      @LazyLlamaDrama 7 месяцев назад

      @@slendii366saved me as well. But for some reason the image isn’t loading at all. I’m getting no error either. Just a black background….

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

      Same

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

    Hi, I have a problem. I have the ground and bg in img folder but whenever I press play, it just makes a light blue screen? How can I fix it?

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

      Sounds like you've got something wrong in the code somewhere. Compare it with the source code in the video description and you should be able to find the problem.

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

      @@CodingWithRuss I compared, but the code is the same. Do you think its a bug? When I runned it today I saw the ground then the picture just shot up to the sky and its just blue

  • @s.a.sproductions5344
    @s.a.sproductions5344 11 месяцев назад

    ModuleNotFoundError: No module named 'pygame' what is this line 1

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

    Hi can anyone help my images aren’t loading and and my quit button isn’t working I’ve checked my code and I can’t see anything wrong

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

    when i tried to run it, it said "IndentationError: expected an indented block after 'while' statement on line 18"

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

      Add an indent to line 18 using tab

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

    From where to download the images and what measurements of image have to take?

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

      Check the link in the description for all the assets you need for this game

    • @g.o.d.d.u.s.o.p.p
      @g.o.d.d.u.s.o.p.p Год назад

      @@CodingWithRuss probably pin the comment so its easy to find

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

    Hello i have error (line 21, in
    bg = pygame.image.load('img/bg.png')
    FileNotFoundError: No such file or directory.)

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

      Please help me thank you

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

      but i have bg.png and ground.png

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

      Did you put the images into a folder called "img"?

    • @Billy-yx6se
      @Billy-yx6se 3 года назад

      @@CodingWithRuss how do we do that?

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

      ​@@CodingWithRuss I've done this and also named the file "bg.png" but it still gives me the same error. is there anything else I can do to fix it??

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

    Hi
    Just starting this one can you tell me where you put the img folder on the pc as it says no file to run I put it on my desktop. so its desktop>img>bg thanks

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

    my ground picture is disappearing after scrolling but yours stand still why

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

      Sounds like you've got a typo in the code somewhere. Compare it with the source code in the video description and you should be able to find the problem.

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

    where do we have to put the images file,
    Traceback (most recent call last):
    File "C:\Users\abhin\Desktop\everything\Python
    ot working python codes\beta python codes\FlappyBird\main.py", line 21, in
    bg = pygame.image.load('img/bg.png')
    FileNotFoundError: No such file or directory.

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

      Put them in a sub folder called "img" so the code can find them

  • @CodingWithRuss
    @CodingWithRuss  4 года назад +8

    Hi folks,
    Code for this video: github.com/russs123/flappy_bird/blob/main/Part_1-Scrolling_Background/flappy_bird_tut1.py
    And you can download the images here: github.com/russs123/flappy_bird/tree/main/img

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

    WHY THE ONLY GREEN PART OF GROUND IMAGE IS MOVING INSTEAD OF THE WHOLE PICTURE

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

    The image is so much large on. My scree

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

    for some reason the ground image wont load even if i just copy the code.. maybe it's my software

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

    in 3:06 my game is not opening, someone explain to me how to fix that or is it normal?

    • @bluecyclone3500
      @bluecyclone3500 7 месяцев назад

      keep on going through tutorial depending on the version of pygame or python you have the code might not work until you have the next part

  • @ryantaylor3496
    @ryantaylor3496 11 месяцев назад

    What terminal are you using for your code?

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

    Which editor you using?

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

    Which software are you using ?.

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

    what code editor do you use?

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

      Sublime text

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

      @@CodingWithRuss For some reason after the second line after "import pygame.locals" where it says "import *", it keep on saying "invalid syntax, and the i of the import is highlighted. Do you have any idea on how to fix this issue?

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

    you copied code with harry right

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

    where are the assets???

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

      Should be linked in the video description. Let me know if you can't download them

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

    Respected Sir-coding on Vscode… but can’t solve the problem (flappy = Bird(100, int(100, screen_height / 2))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^). Thank you..

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

      Hello, what error do you get?

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

      @@CodingWithRuss Respected Sir happy to say…that’s my mistake..now solved…thanks

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

      @@ushabothra7912 Good job!

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

    can't download any of these files in description.the game is good but i do not know where to get photos.can't you do anything properly.i used to be a subscriber,and now i am unsubscribing

    • @Oogaboogabooboo
      @Oogaboogabooboo 9 месяцев назад +3

      Mf you don’t need the exact photos for the game. Make it your own, just follow his code 🤷‍♂️. It’s kinda sad that you’d make a comment like this to highlight your own inadequacies. I literally started learning code two days ago and I could understand almost everything in this video, there’s no way you couldn’t do some googling to help yourself 🤦‍♂️

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

      @@Oogaboogabooboo😂😂 chill on bro 🤣 ctfu you right tho. Did you ever make the game ?

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

    my bg image script and my ground script won work heres the error message: bg = pygame.image.load('img/bg.png')
    FileNotFoundError: No file 'img/bg.png' found in working directory 'C:\Users\biswa\PycharmProjects\pythonProject9'.

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

      It means it can't find the file in that folder. Do you have the images in that location in subfolder "img"