PyGame Scrolling Shooter Game Beginner Tutorial in Python - PART 12 | Main Menu and Restart Level

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

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

  • @HostileOTB
    @HostileOTB 3 года назад +11

    You're under-rated aha I've learnt more from simply watching this then going through hour long courses. Hope to see more from you.

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

      Thanks a lot! I'm glad these are helpful 🙂

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

    This was excellent, I have watched so many “state videos” but they always create separate state handlers which make it difficult to follow. This was very easy to follow along. I also like that you assist the viewer by only creating new variables just before you use them. It makes it easier to understand specifically what you are working on.

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

      Thanks Dan! Glad to hear the videos are useful

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

    "Hello folks" is the intro i have been waiting for days lol love your tutorials

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

    Hey Russ just want to let you know you have inspired me my friend... I just spent the last 2 days trying to fig out how to do what you explained in this video and today ugh finally I got it done sadly it is not as nicely coded as your code but never the less I did it on y own ! this doesn't mean I am done watching you I have a lot to learn but it means that I am getting the know how on things and can't thank you enough. I have added things like lives and removing the dead sprites as there killed I redid the Level editor and made it with other stuff the list goes on man ........ You are amazing my friend would love to share the pics of things I made so far if i can let me know how other wise nw you rock no matter what :D

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

      Thanks a lot! That's really good to hear and that's definitely the way to learn, just by figuring stuff out, adding new features etc. I'm no expert and have been learning exactly the same way. Yea I always like seeing what others have done and what features they've added etc. Maybe you can put the pics online? There's lots of free image sharing sites (imgur, imgbb)

  • @АнтонНазарук-щ5с
    @АнтонНазарук-щ5с 2 года назад +1

    Another lesson completed, still working as a charm
    Thanks alot, Russ, dear teacher

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

      Thanks Anton, glad to hear it. Looks like you have nearly completed this one :)

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

    Your vids was great!!!
    However for thoese that don't know:
    If the screen scrolls the enemie visions actually doesn't adjust the position
    So in the AI funtion that's inside the solder class, after self.rect.x += screen_scroll, just put self.vision.x += screen_scroll and that will fix the problem!

  • @OmarRamirez-ed1bw
    @OmarRamirez-ed1bw 3 года назад +1

    is about waiting everyday to continue this great proyect bro, amazing

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

      Thanks! I will have the last part uploaded soon

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

    Just subbed, you're incredible man, looking forward to more videos!

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

    I am on a roll today!

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

    it's really helpful to me thank you

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

      Glad to hear it!

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

      @@CodingWithRuss Can you tell me about the next campaign

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

      @@CodingWithRuss I can't do anything to get the player to stand up in the box, hoping for your help

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

    Hello Russ , I had an error I was hoping you can help me solve
    in the
    "with open(f'level{level}_data.csv', newline='') as csvfile:
    reader = csv.reader(csvfile, delimiter=',')
    for x, row in enumerate(reader):
    for y, tile in enumerate(row):
    world_data[x][y] = int(tile)
    world = World()
    player, health_bar = world.process_data(world_data)"
    in both the new level and restart level I get this error "list index out of range", I have created the empty list world_data and I have "level1_data level2_data and level3_data in my folder

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

    Cool

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

    Hey man, i been working through this series quite diligently.
    I am having an issue here at the end. Some of the enemies seem to not turn around in teim, and walk off the edge of whatever they are standing on, and fall to their demise.
    Any ideas, on where I might have made a mistake in the coding, ie - where to look?
    I have dl'd your example from github...but struggling to see discrepancies.

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

      Nevermind, i found it. was the speed argument on the soldier class...at 3, meant the soldier were walking off the edges..

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

      Would there be a method or collision formula that would force the enemy unit to switch directions, if it reached the edge of the platform it was standing on. I am assuming it would be with the collision section, regarding the enemy bottom and the tile top. but I guess I dont fully understand the formula in order to amend or add a check for this.

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

      Hi Harry, glad you got it figured out, I didn't get round to checking the comments until now.
      Yea you definitely could add in a bit more intelligence to the AI - one way I can think of would be that prior to the enemy moving, it first does a check to see if there is a ground tile in front of it (you would take the soldier's co-ordinates, work out where he is on the tile map and then check the next tile over). It's doable, but could be a little tricky to get right. I took the easy way out and just made sure they had enough room when creating levels, but it was trial and error and there were lots of red guys falling off during that process 😀

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

      @@CodingWithRuss 100% Thanks man. Just finished your series. Its great stuff, and I have started working on my own project because of it. (only 3 months into learning python...so, its slow going.)

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

    Can you teach us how to make apps with python?

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

    amazing

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

    in process_data
    return player, health_bar
    UnboundLocalError: local variable 'player' referenced before assignment
    how do i fix this?

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

      Have you created any level files yet? If so, make sure the player has a spawn point I had the same issue.

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

      @@khorneflakes4446 yeh I figured this out 4 months ago, thanks anyways though

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

    I have added depleting maximum HP and I want to continue to base the game around trading HP for items. Is there a way to not have the HP and items reset upon entering new levels?

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

    How do I specifically load a level/csv file? I've been trying to create a "tutorial" level and have been struggling

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

    Time line 23:14 - You declare level_complete = False and True in the next If routine. I'm using MS Visual Studio and it the two variables won't even acknowledge each other (greyed out). I've even tried using a Global and that's just painful. Any answers appreciated, I've come too far to give up now :(

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

      I just opened it up in VS code to check and it works fine. You sure there are no typos in the variable names?
      What error do you get?

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

      I don't how your doing it but I just can't get a boolean statement returned from the class. Literature says Python doesn't do this. I set screen_scroll to 1000 to get the argument back. But now I can't get level_complete back to False and all the tiles on the next level are a jumbled mess.

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

      @@CodingWithRuss Thanks Russ, no typos, I swapped the True/False argument for a 0 or 1 argument, presto, worked. But the tiles still won't load correctly next level. I'm thinking of putting that all into a def load_tiles routine. Cheers - great tutoring.

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

      OK that worked onto level 13

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

      ​@@philluvschips3787 Phew! Strange that the original code runs for me and not for you, but glad to hear you got it working another way.

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

    when i try to add menu, when i try its not responding

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

    Hello Russ, thank you so much for your amazing videos ! One day, can you make a video on how to use spritesheet in pygame ? Thank you again !

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

      Thanks Max, yea sure, I plan to do that soon!

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

      @@CodingWithRuss Okay, thank you !

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

    is there some solution to the game screen freezing for a bit before i restart the game?

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

    How do you get the level editor?

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

    please, someone explain time[1], time[0] means and why in screenblit we pass two values of title at once: title[1]?

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

    great video but quick question how do you save the level_data files it does not say the download button can you help me

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

      I didn't notice that before. You could fork/clone the repo and then you will have all the files in the correct folders automatically

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

      @@CodingWithRuss thanks so much your videos are the best m thing worked well

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

      @@CodingWithRuss oh and i subscribed to you

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

      @@annmugo Thanks :)

  • @Short.duniya.123
    @Short.duniya.123 6 месяцев назад

    Hey import button not module not found please tell me❤

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

      Did you create the button.py file and put it in the same folder as main.py

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

    how many more video will it take to complete.

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

    Hi! Thanks for the tutorial! When the game loads level 2, I get this error:
    world_data[x][y] = int(tile)
    IndexError: list assignment index out of range
    I've checked to make sure that nothing was wrong, but is there something I could be missing?

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

      Do you have the level_data file in the folder? It may be missing

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

      @@CodingWithRuss No, I had forgotten to create an empty list for the world_data variable. I have it fixed now, but thank you for getting back to me. I do want to try to create a level menu system, so that instead of just automatically playing the next level, there is menu for navigating through unlocked levels. If you think this is a good idea, I was wondering if you could do a tutorial on it? You're really good at figuring stuff out, so I thought this might be up your alley.

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

      @@StormwreckerOfficial Ah nice, glad you got it working. That does sound like a good feature and could be interesting to develop something like that. It could be done with a bunch of buttons (i have an existing button class that could be used for this). Then each button will be assigned a specific level number so when any of them are clicked, it will launch that level.
      That's how I would approach it and see if it works. I wouldn't have time to work on that now though, I've been working on my website, which is taking a lot of time.

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

      @@CodingWithRuss I understand. I have been working on getting it up and running. I have created a separate level button class which has extra characteristics, including an integer which represents the level that the button is "storing." I have also created a "game_state" variable that updates every time the game switches between menus. There are some bugs I've been fixing, but it is do-able. If you want, I could send it to you via email, so you could kind of "proof-read" it for inefficient code.

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

    Hey it is bringing an error saying base_color and hovering_color argument are required from the button class 😭 help pls 🥺

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

      Hello, the button code used for this game doesn't use those variables, double check the code on github to make sure you have the right one.

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

    I can't access the link for assets Please create a new link for downloading assets.

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

      I'll update the links. Try my github for now, all the assets are there: github.com/russs123/Shooter

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

    How come level 3 is just a bunch of "Nothing-Ness"?

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

      My imagination ran out after 2 levels :D. The rest of the levels are a blank canvas for you guys to create

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

      @@CodingWithRuss Yeah I saw that you made a "Level Editor" Now I have 4 levels :)

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

    Anyway someone can help me out? When I run this pygame doesn't respond and I have to exit using the python shell to get rid of the pygame screen.

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

      I know it.s been so many years, but maybe if you are still here... Have you resolved this issue? It's the same for me and i can't wrap my head around it no matter what i try

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

    My buttons are not working

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

      You may have made a typo somewhere. Take a look at the source code in the description and see if you can find the issue

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

      @@CodingWithRuss error solve

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

    Hello bro

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

    My import function isnt working for some reason.. can you tell why?
    nvm nvm it works now, Thanks for all these tuts till now, helped alot!

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

    russ I'm an eight year old kid how did you get in to coding?

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

      Hi Eli, I started by following tutorials to learn the basics and then started making my own games. Start with something small first, like tic tac toe and see if you can make it yourself. Then from there you can move to bigger projects

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

      @@CodingWithRuss thanks

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

    o/ :D

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

    How to sell our game online..?