PyGame Beginner Tutorial in Python - Infinite Scrolling Background

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

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

  • @nazr763
    @nazr763 2 года назад +24

    I am Japanese. There are not many people in Japan who are uploading videos on making games in python, so this video is very helpful. Thanks a lot for your clear and detailed explanations!

  • @jermania7467
    @jermania7467 2 года назад +17

    Good to see new content again. You do have some of the best python tutorials out here. Thanks!

  • @GamingGuruImMortaL
    @GamingGuruImMortaL 2 года назад +6

    Finally pygame content is back!🤣🤣
    Bro you make one of the best pygame tutorials, please continue to do so in future.

  • @SouthWinner8922
    @SouthWinner8922 16 дней назад +1

    Great Thanks a lot !It was a very clear and easy tutorial for a beginner in pygame like me,Way to go !

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

    Wow! nice to see you back sir! Also Liked!!

  • @Dexjet
    @Dexjet 2 года назад +6

    Exceptional Tutorial as always. Thanks so much.

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

    YES great to see your back i did all of the platformer

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

    Nice to see you again !!! i try to make smoothless the scroll downsizing the fps, but with no result ...

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

      Thanks! Yes I had this problem as well, and when I looked into it online it seems to be one of the limitations of pygame. Normally in the game you would have more things on the screen so the background won't be as noticeable, but when it is the only thing on the screen it does look like it is a little jittery.

  • @BRO...21
    @BRO...21 2 года назад +1

    Thank you very much, I like it and this is the best tutorial i have

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

    Thanks for the video helped me a lot!

  • @kevinrafaeldiazlopez3699
    @kevinrafaeldiazlopez3699 Месяц назад +1

    Good video, thank you very much.

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

    This helped me a lot
    I'll surely send you the Game I'm working one ❤️

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

    Thanks Russ! Thanks

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

      You're welcome!

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

      @@CodingWithRuss am learning so fast i need to slow down!

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

    Next video, i hope you will do st about effect and shader

  • @Nightmare-dd4bp
    @Nightmare-dd4bp 2 года назад +2

    Thanks

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

    thank you so much!

  • @CharlieAngel-vy5zi
    @CharlieAngel-vy5zi 4 месяца назад +1

    Thanks very useful I am searching how to do parallax now

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

    Thanks so much for your tutorials. They are helping me a lot.
    Can you please maybe teach how to do a main menu with two different backgrounds? For example 1 bg in menu with buttons play, credits and exit and when the credits button been clicked another bg appears with the button to back to main menu. It will help me a lot with my game to college 😁

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

      Glad to hear the tutorials are helping.
      I have a tutorial in my shooter game which has a main menu. It has play and exit, so you will need to add the credits option yourself but the tutorial explains the logic for the menu so you will be able to figure out how to add more options: ruclips.net/video/wWLDUb71mFo/видео.html

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

    How do I make the background move with my player?

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

    How can you change the Y coordinate of each individual image so each one is at a different height

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

    Thank you know I can tell my father how to create a scrolling background

  • @JaJ-w3b
    @JaJ-w3b Год назад +1

    I know you can scroll the opposite way by scroll += but it doesn't load the new image near as smoothly on the left, any tips? Thanks

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

    I from Polan
    bro Zajebista Robota🙂

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

    nice to see you again are you okay tho? your voice seems different stay healthy :D

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

      Yea I'm all good, thanks! I don't know why it sounded different...I must be out of practice :)

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

    bro you are the best 😢 love from india can you me playlist on pythone 3d games ❤

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

    thanks from Algeria

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

    Wow thanks alot for this awesome tutorial

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

    Thanks so much, love the content.
    I've figured how to do this vertically but would it be possible to do it in the opposite direction

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

      how did you make it vertical?

  • @localbroadcast
    @localbroadcast 25 дней назад

    Small question: Line 12, You initiate a new instance of the class pygame with that instance named 'screen'. Within the same line of code you set the pygame attribute 'display.set_mode'. I follow this without any issues. The code I find peculiar is on line 13. The purpose of line 13 is obviously to set the attribute 'display.set_caption' in order to give the window an appropriate title text. I find this peculiar because intuitively I would like line 13 to be: 'screen.set_caption("Endless Scroll")' instead since the instance named 'screen' has already been created. Is there something specifically about the pygame.display class that only allows a single instance of it to be initiated at a time or something???
    Normally shouldn't I be able to have as many copies of the code on line 12 as I like, just replacing 'screen' on each line with 'screen_1', 'screen_2', 'screen_N', etc. etc.??
    If I were to do this, how would the code on the next line, "pygame.display.set_caption("Endless Scroll") be able to know which instance of pygame.display was being referenced?
    I hope my question is understandable and I hope someone has an answer even though this vid was uploaded 2 years ago!

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

    which programm do u use?

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

    Russ, can you make a tutorial on a background which follows the player?

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

      look at the parallax background tutorial, that shows the background moving with controls of the user

  • @Code-d4b
    @Code-d4b Месяц назад

    where did you get the background from

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

    Thank you so much! However, I need to do this in C, is it possible?

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

    hello, how do you make the screen scroll gradually faster

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

      Instead of scroll -= 5 you could do something like scroll -= scroll_speed. Then you can gradually increase the scroll_speed variable using a timer or a counter so your scrolling will be sped up

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

      @@CodingWithRuss thank you!

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

    is there a way or tut how to add ground on this scrolling bcgr that ground would scroll slower , or how to implement 2 or 3 different scrolling surface or assets?

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

      did you figure out a solution?

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

      I lost my code all ness gonna start all over🎉thanks

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

    Any chance this is doable with height as well as width?

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

      Yea it can be applied vertically in the same way

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

    hi, thank you for you for this tutorial. I attempted to implement it for Y-axis scrolling, but it only functions in one direction (scrolling upwards). However, when I tried it for the opposite direction, it appears as if the image is being dragged (similar to what happens at the 9:13 mark in the video). Do you have any advice to offer that could assist me?

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

      The problem is likely to be the same as what I demonstrated in the video. It's just happening on the vertical axis instead of horizontal. It sounds like the second image isn't coming in behind the first and you end up with this dragging effect. Check that you're passing the right coordinates for the second image to come in at the right location.

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

      thanks for answer. it was just a " - " what I needed hahaha xD

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

      @@yurabohm2561 Where? haha

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

    Understood complete

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

    Hello quick question, if i need to do it for clouds for example like in stardew valley menu interface. Can i use only 1 image with 5-6 clouds and move it like in the video but ofcourse slowly. Ty for the video

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

      Hello. Yes sure that would work as well and you could even have different clouds move at different speeds if you wanted to.

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

    I am trying to make my program working but the -= operator isn't doing anything. How can I fix?

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

    It worked

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

    Hi! Apparently I am trying to combine this endless scrolling with your parallax scrolling. However I can't seem to get it work properly, it fails to blit the background layer in on time and keeps glitching

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

    how can i add words, bgm or other img on it? the bg still looping but the words and img on it are still

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

    or use modulus operator for the position

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

    Is it possible to somehow impement it in def function ?

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

      Yes, sure. You could put it into a function or even a class if you like.

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

    What if i want to make it scroll vertically? Should I just swap width with height?

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

      Yea pretty much. Same logic but on the y axis instead

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

      @@CodingWithRuss perfect, thank you so much

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

      @@Floffffff How did you do that?

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

    good

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

      thanks

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

      @@CodingWithRuss hi man you've helped me a lot i didn't expect you to see my comment really thank you for your effort really appreciate your content

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

    trying to do this to get it to scroll vertically but it jus scrolls horizontally...

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

      To scroll vertically you would need to change it to move along the y axis instead of the x axis

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

    Cool😂

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

    sir sir pls tell me why the buttonmodule is not downloading using pip sir pls tell me sir i have less time pls pls sir a humble request from me

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

    After writing entire code on VSCODE it is showing fault about bg = pygame.image.load(" BG.png").convert()
    Please Sir if possible solve my problem.....Thanks a lot.

  • @scratchasmr-yash4958
    @scratchasmr-yash4958 Год назад

    It is only scrolling perfectly towards right but not towards left 🤔

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

      It will scroll left as well but you have to adjust the code so the background images are drawn on the left otherwise you will get a smudging looking effect

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

    9:24

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

    Hold that like

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

    Your videos are great, could you leave your codes written here, hugs.

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

    BAD tutorial, now I perfectly understand why you have a few likes. IT says Beginner tutorial but then you just assume we already know what frames rates and clocks are and what they do. Really bad....

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

      that's basic knowledge of computers buddy. those arent necessarily coding terms.

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

      if you only know the basics you are a beginner so if you dont know it you just nothing not even a beginner