Street Fighter Style Fighting Game in Python using Pygame - Complete Tutorial

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

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

  • @RockyShao22
    @RockyShao22 3 месяца назад +14

    I'm president for my highschool programming club, and I'm going to "shamelessly" copy down this project and let my club members build ontop this project and learn through the way!
    Thank you so much for sharing this video in such amazing detail! Best tutorial ever!

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

      That sounds great! You're welcome to download and use the code as you like. Good luck with your projects.

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

    Its 2024 and im still watching your tutorials, thank you so much please continue to make tutorials, i watch a lot of them and i find your tutorials easier to understand than the other tutorials, thank you so much!! You have paved my way in the world of programming.😊

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

      Thank you, that's great to hear :) Glad the tutorials have been helpful

  • @captainlevi7344
    @captainlevi7344 2 года назад +51

    No word is enough to thank this guy for doing such awesome project for completely FREE... I think I'm loving longer video more than the videos uploaded part by part... 💜

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

      Thanks, I'm glad you liked it!

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

      The fact that it's a praise from captain Levi makes it even more honourable

  • @Harmonikas1992
    @Harmonikas1992 2 года назад +78

    You do not get a course about just programming a game, also about how to structure your project. Very good Tutorial

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

      Thank you, glad you like it

    • @HURRY-UP-N-BUY
      @HURRY-UP-N-BUY Год назад +2

      Great Video...Is this Code available ?

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

      ​@@HURRY-UP-N-BUYyes check the description

  • @phjones01
    @phjones01 Год назад +15

    Has to be one of the best and concise programming tutorials on RUclips. Really nice explanation on how the sprite sheet is processed and how you overcome each problem. I have said it before, you're such an excellent tutor. I am a Software Engineer for a living and these concepts are so well explained 👏

  • @zachblackwell2760
    @zachblackwell2760 2 года назад +31

    I watched the entire video and coded alongside you each step of the way and was able to complete it with a few changes here and there. This is so cool man! I have gained more knowledge from this video than I have from many of my college courses haha. Thank you so much for taking out the time to create such helpful and top tier content. Would love to see and learn more from future videos regarding game development with Pygame!

  • @AbdulRahman-w6s
    @AbdulRahman-w6s 2 месяца назад +2

    any one who want to learn python just follow this tutorial that's every thing in it. i am copying it and changing few things i have learned alot. thank you coding with russ, (Rustam) you are most generous guy on youtube you gave us code sheet and you explained every single thing in detail and perfect. a lot of best wishes for you.

  • @UnleashedEntomber
    @UnleashedEntomber 2 года назад +22

    Wow, you said that you prepared something new, but I wasn't expecting that it will be so awesome! Thanks, going to code it with you with pleasure

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

      Glad to hear it :) Hopefully it's clear and easy to follow!

  • @AYoshiGamer36
    @AYoshiGamer36 2 дня назад

    Thank you for making such a high quality tutorial for free - you are the best pygame teacher I have seen

  • @insanitygaming5048
    @insanitygaming5048 Год назад +5

    Coding with russ should be more famous you are the no 1 channel for me in programming i wanted to make a platformer game but i had problems with the collisions but your tutorial helped me i also wanted to make a shadow fight type of game and this is the video thank you so much for teaching this to us for free as well as the assets for the game is also free so i can just go straight to coding and not worry about finding sprites for it. Much love from the philippines

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

      Thanks! Glad to hear the tutorials helped you out :)

  • @HammerHeadGameStudio
    @HammerHeadGameStudio 2 года назад +7

    This is great! I modified slightly to include high and low attacks and a shooting attack with 8 frames. Just working out now how to have multiple different shaped fighters with some different sizes, shapes and attack patterns. For anyone interested, here's the low, high, shoot code:

    # attack
    if key[pygame.K_r] or key[pygame.K_t] or key[pygame.K_f] or key[pygame.K_g] or key[pygame.K_SPACE]:
    if self.attack_cooldown == 0:
    self.attacking = True
    if key[pygame.K_r] or key[pygame.K_t]: # determine which attack type
    self.high_attack(surface, target)
    if key[pygame.K_r]:
    self.attack_type = 1
    if key[pygame.K_t]:
    self.attack_type = 2
    if key[pygame.K_f] or key[pygame.K_g]:
    self.low_attack(surface, target)
    if key[pygame.K_f]:
    self.attack_type = 3
    if key[pygame.K_g]:
    self.attack_type = 4
    if key[pygame.K_SPACE]:
    self.shooting_attack(surface, target)
    self.shoot += 1
    self.attack_type = 5
    if self.shoot >= 8:
    self.attack_cooldown = 50
    self.shoot = 0
    self.attacking = False
    #attacker 2 tweaks
    if key[pygame.K_KP4] or key[pygame.K_KP5] or key[pygame.K_KP1] or key[pygame.K_KP2] or key[pygame.K_KP0]:
    if self.attack_cooldown == 0:
    self.attacking = True
    if key[pygame.K_KP4] or key[pygame.K_KP5]:
    self.high_attack(surface, target)
    if key[pygame.K_KP4]:
    self.attack_type = 1
    if key[pygame.K_KP5]:
    self.attack_type = 2
    if key[pygame.K_KP1] or key[pygame.K_KP2]:
    self.low_attack(surface, target)
    if key[pygame.K_KP1]:
    self.attack_type = 3
    if key[pygame.K_KP2]:
    self.attack_type = 4
    if key[pygame.K_KP0]:
    self.shooting_attack(surface, target)
    self.shoot += 1
    self.attack_type = 5
    if self.shoot >= 8:
    self.attack_cooldown = 50
    self.shoot = 0
    self.attacking = False
    # create attack space
    def high_attack(self, surface, target):
    attacking_rect = pygame.Rect(self.rect.centerx - (1.5 * self.rect.width * self.flip), self.rect.y, 1.5 * self.rect.width, self.rect.height / 2)
    if attacking_rect.colliderect(target.rect):
    target.health -= 10
    target.hit = True
    pygame.draw.rect(surface, (0, 255, 0), attacking_rect)
    self.attack_cooldown = 20
    def low_attack(self, surface, target):
    attacking_rect = pygame.Rect(self.rect.centerx - (1.5 * self.rect.width * self.flip), self.rect.centery, 1.5 * self.rect.width, self.rect.height/2)
    if attacking_rect.colliderect(target.rect):
    target.health -= 10
    target.hit = True
    pygame.draw.rect(surface, (0, 255, 0), attacking_rect)
    self.attack_cooldown = 20
    def shooting_attack(self, surface, target):
    attacking_rect = pygame.Rect(self.rect.centerx - (0.5 * self.rect.width * self.flip) + 50 * self.shoot - (100 * self.shoot * self.flip), (self.rect.centery - 50), 0.5 * self.rect.width, self.rect.height / 4)
    if attacking_rect.colliderect(target.rect):
    target.health -= 5
    target.hit = True
    pygame.draw.rect(surface, (0, 255, 0), attacking_rect)
    I have had to tweak the code elsewhere as I haven't included the artwork yet, which has not been created.
    FYI: love your content--keep it up!

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

      Thanks! Glad you liked it. It's really cool to see what additional features people add into these games.

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

      do you have the whole code, id be interested in looking at the whole thing

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

      @@rozenoce if you're curious... ruclips.net/video/WsIm0Tq6Az0/видео.html

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

      Did you manage to implement more characters in the street fighter clone?

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

      @@amanvirdhaliwal1143 yes, one more with unique sprites, a chubby clown with a scythe, but I haven't implemented all the hit boxes for it. Mainly because I've been sidetracked with other things 😂
      (It has some hit boxes that I've just inherited from the old class and others have been overwritten)

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

    just made it through the tutorial....thanks again...now i have a basis to keep working and changing the game....i always needed a template for a fighter :)

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

    This is incredible!

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

    You are a legend and a master to many people around the world who are learning to code, W human being

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

      Thanks for the kind words :) Glad you like the videos.

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

    This looks amazing! Can't wait to get started on it.

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

    Someone give this guy some credit, this is amazing!

  • @lpslpslpslpslpslps
    @lpslpslpslpslpslps 2 года назад +8

    This is great! It is like those old school 1980 magazines that had BASIC code you could type in your c64 or whatever, except with explanation and in video format.

  • @djskinztech
    @djskinztech 10 месяцев назад

    I just finished this tutorial and it was so good! Thanks Russ! I appreciate your time and dedication to finishing this project! Keep it Up!

    • @djskinztech
      @djskinztech 10 месяцев назад

      I also had a question. Do you think people should still learn pygame or is there advantages to learning godot instead?

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

    Thanks for taking the time and making this amazing video mate 🚀

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

    It was my dream to make a game like street fighter. And see today because of you i can. Thanks a lot for this.

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

      No problem! Glad to hear the video helped

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

    Finished the game with some additional features, Thanks brother

  • @TheArabAlii
    @TheArabAlii Год назад +3

    You are one of, if not, my favorite youtuber and the most helpful game development channel ever! I actually learned and made my first game thanks to you/ I subscribed and will DEFINITELY share this to others! 😄

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

      Thank you! Glad to hear you made your first game :)

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

      Thanks for replying!!! You're the man, you're also really underrated, still replying to comments on an old video and only got 16k subs?! I will be sure to help get more, by sharing like I said. :D

  • @이성호-d5x
    @이성호-d5x 2 года назад +2

    You are so great! Your tutorial makes me get a couple of ideas how to progress code just in case I can't imagine. Thank you for your video.

  • @samurai-capybara
    @samurai-capybara 2 года назад +1

    Exactly what i was looking for (next stage is to try to build an AI to play it!). One of the clearest tutorials I've ever seen.... thank you!

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

      Thanks, glad it was useful!

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

      How do you do that tho? Is it not recomended for Beginner?

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

      did you manage to make the AI?

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

    OMG ITS WORKED. Guys it really worked. Thank you

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

    Excellent tutorial, clearly explained from start to finish!

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

    I love this channel!! So glad I found it.

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

    I’m a student who’s taking a Computer Science course. 20% of our grade is to create a game using pygame, I decided to create a game similar to Street Fighter II, I was struggling up until now but this really helps me. However I can’t copy the code as then I’d simply just be cheating myself. Could you sort create a separate video why you’re doing what you’re doing for a newbie like myself? if that’s too much work no problem man this has been more than helpful. I’m just new to pygame and I’ve never really created a game in python before just mainly programs to calculate different things so this is all new to me. Appreciate the video!

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

      Hello, glad the video is helping. If you haven't used pygame or made games before then a fighting game like this would be quite complicated to begin with, but if you go through it slowly you'll find it will start to make sense. You may need to rewatch parts of it for it to fully click into place.

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

      @@CodingWithRuss Yeah, I definitely am and you’re helping out a lot. Keep it up man!

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

    this is one of the best tutorials ever

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

    I am very glad that I stumbled upon your video

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

    I'm beginner and I'm very confused with the list process and self statements as well. However, I really appreciate this video and had tons of fun copying you as an exercise. Thank you, Russ!

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

    I'm a beginner of python, thank u very much for make this video!!!!!

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

    Tutorials are getting better and better!!!!! Thanks for all the knowledge.

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

    Hello Teacher , thank you for this wonderful tutorial

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

    incredible video, I was just looking for this type of tutorial, thanks you it was perfect !!!! Thanks to you I created a fight game that I developed it with different types of attacks and even a kamehameha

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

    Well done! I followed along and learned a lot. Great tutorial.

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

    Really nice video. Thanks to you I was able to do my project for OOP lecture.

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

    All of your videos are so good I can’t even explain, I’ve learned so much just from these videos
    Thank you
    🎉🎉

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

      Thanks! Glad you found them useful :)

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

    great tutorial man. thank you for making this. i learned a lot more from this video than my teacher taught me.

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

      Thanks! Glad to hear you found it useful

  • @vinskey544
    @vinskey544 8 месяцев назад +2

    Thanks Russ, this helped me a lot!!

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

    Great tutorial. You still remain one of the best to follow.

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

    Why do we add the ".convert_alpha at 6:20 ? I tried without it and the code still works... does it make a higher resolution?

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

      It matches the image format to the game window format to speed things up. This explains it better: www.pygame.org/docs/ref/surface.html#pygame.Surface.convert_alpha

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

    Hi Russ, I'm enjoying the tutorial so far but as I was following along my health bar wouldn't budge when I hit the opponent. I feel like I've tried everything after trying to debug my code for an hour but have nothing. Any advice? 45:35

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

      Check the process of the health bar drawing again it's not long and you can be sure he's code is good, I had a problem too but it turned out I've set the same color for red and yellow.

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

    Guys can anybody help me? I'm on minute 1:26.00 but when I run my code, it looks like the list is taking the animation from bottom to top. As a result, my fighters are starting with the animation "death", not really "idle". I was comparing the list code with the original article but looks like I'm following it properly. Any ideas?

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

      Found it guys. The mistake was that I missed a tab when creating my for loops in the spritesheet import part. The x loop wasn't added inside the y loop, but now it's fixed after 3 hours looking at the code and relying on coffee at 3 AM XD

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

      @@fernandoanholon1141 now I'm stuck, can I get help! :)

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

      @@ayshasaifalkaabi what's happening?

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

    This is absolutely brilliant!!!

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

    I need your help with the sprite animation. I see in 56:44 you loaded all the individual sprite animation in one using paint. Can you explain how you did that please?

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

    When i try to run my code at 1:08:13 it says "AttributeError: 'builtin_function_or_method' object has no attribute 'subsurface' ". Do i need to download something that i don't already have?

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

      No, it's probably just a typo somewhere in the code. Have a look at the code in the description and compare it with yours and see if you can spot what might be causing the issue

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

    This is awesome!! I was wondering if you could make a video how to make a menu and level choice type of thing to add on a game like this. I am fairly new to coding and your videos have taught me so much. Thanks!!

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

      Thanks! I plan to make a tutorial on menu systems in the future, but in the meantime I do have a menu system in my shooter game, which you can use as a starting point to see how the logic of it is done: ruclips.net/video/wWLDUb71mFo/видео.html

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

    Ok I loved this so much that I took this project and started going further into the process of making it full. It would mean the world to me if you got back to me I would love to show you it!

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

    Ur channel is so precious. Thank u and pls keep going 🙏❤️

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

    Oh my oh my! It's like a show on a streamer man!

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

    Hey Russ....wow thanks a lot....can't wait to start this tutorial.....

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

    I'm stuck around 1:05:30, i have sprites of the size of 288x128 and i can't figure out how to make it work. I tried self.size_width/height for the extraction of the spritesheet and that also did'nt work out. It says that it has no attribute. Could you help me with that?

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

      Hello. Hard to know what the problem is as it could be different things. Are you able to get it working with the images I used in this game and are your sprites layed out in the same way?
      What is the full error message that you get?

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

      @@CodingWithRuss I have not added the images for the sprites yet but the size of my sprites are 228(width) and 128(height). The way how i did that is: ''MONK_SIZE = 288, 128''. The rest i did the same as you did in the video but it doesn't get through the test run. If i try i get this: "File "c:\Users\Berna\Python\arcade fighter\fighters.py", line 22, in load_images
      temp_img = sprite_sheet.subsurface(x * self.size, y * self.size, self.size, self.size)
      ValueError: invalid rectstyle argument"

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

      @@jadeverhoeven2464 Oh I see. the code is expecting self.size to be a single value, but you have assigned 2 different numbers to it. So what you could do is change to MONK_SIZE = (288, 128) to make it into a tuple. Then you can access the width as self.size[0] and height as self.size[1]. The numbers in the square brackets are the "index" so [0] is the first value in MONK_SIZE, which is 288 and [1] is the second, which is 128.
      You would need to do that wherever I previously called the self.size variable.

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

      @@CodingWithRuss i have done that but now it's saying this:
      File "c:\Users\Berna\Python\arcade fighter\fighters.py", line 22, in load_images
      temp_img = sprite_sheet.subsurface(x * self.size[0], y * self.size[1], self.size[0], self.size[1])
      ValueError: subsurface rectangle outside surface area

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

      @@jadeverhoeven2464 Yes I think you will run into issues with using an image that isn't square since that's how this project is coded. You could certainly use rectangular images, but you will need to overcome these errors. I can't help with each one but the main thing is to look at what each of those functions is doing and what inputs it needs. Then you can pick when to use self.size[0] and [1] to avoid the errors.

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

    1:08:15 i get "ValueError: subsurface rectangle outside surface area". When i change x and y to 0 it all works but else no. What have i done wrong? I've checked typos thru the sprite sheet load section of the video up to 1:08:15 so i think the issue may be the frames im picking from the animation. I did'nt use the same sprite sheets as you so that maybe the root to the problem.

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

      I SOLVED IT. I just changed to ur sprite sheet it was the frames.

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

      Ah nice, glad you got it working

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

    helloooooooo I have a question in minute 13:27 the rectangles arent appearing on my screen

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

    thank you so much for creating these videos :)

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

    I know this is a stupid question but how do u find out how many pixels each frame is, when I try and show the animation it comes up with error - subsurface is off the surface area

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

    That's amazing! next a beat em up maybe? I'd love that!

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

      That would be pretty cool actually, I loved those games as a kid!

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

    Hi Russ, love the video! If you make the second part, then you want to have the opportunity to choose a hero / arena

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

    Hey, Russ, thanks for the great video. But for some reason when I tried to run the code at 23:50 the player wouldn't go up, instead it would go to the left and wouldn't be able to move anywhere else since for some reason it think that dy means left because it has a value of -30. And it won't move until it gets there, which it can't since there's a barrier preventing it from doing so. What can I do? I'm using Visual Studio Code if that helps. Thanks!
    Edit: And when I tried to apply gravity, instead of immediately going down, it went to the right.
    Edit 2: It's basically just jumping from left to right instead of up to down. How do I fix this?

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

      Hi Leonardo, the x axis is for left and right movement and the y axis is for up and down movement, so the dy variable is on the y axis and should move the player up.
      It sound like you may have mixed up the x and y coordinate variables in your code so you are applying jumping and gravity to X instead of Y and it's moving left and right instead of up and down.

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

      @@CodingWithRuss You were right, thank you so much!

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

      @@theh0llowkn1ght74 Glad to hear you got it working!

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

      @@CodingWithRuss Hey again, everything is working out normally, but I was wondering if you could share the image of the warrior and wizard sprite sheets? I know that it's in the description, but in the video you said that you had to put them all into one sheet on your own. Do you think you could put it in the description of the video, please? Thanks again

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

      @@theh0llowkn1ght74 Hello. The combined spritesheet is included in the assets folder on github (link in description). The folder includes the individual images as well as the combined sheet

  • @erio-y4y
    @erio-y4y 5 месяцев назад

    hello, after implementing the character sprites , my characters no longer move. I am referring to around 1:08:21 in the video. I am a complete beginner so any feedback and tips would be greatly appreciated

    • @erio-y4y
      @erio-y4y 5 месяцев назад

      i am still able to click r and T to attack but a w and d have no output

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

    I have paused your video at 1:11:57... I'm trying to run the game the same way you did, just before you cleared out the print statement in load_images. However, I'm getting the error "AttributeError: 'builtin_function_or_method' object has no attribute 'subsurface'." I've looked at your code and mine, and found nothing that suggests I missed something. What's wrong here? I'm sure it's something simple.

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

      Hard to say without seeing your code, could you upload it somewhere? Or alternatively, if you want to keep troubleshooting it yourself, try pasting your code and my code (from github) into a code comparison app (for example: www.diffchecker.com/) and it might point out a missing bracket or something that could be causing the error.

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

      @@CodingWithRuss I sent you my code via email. I am still stuck in the same spot.

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

      Oh. I found the problem (hey, thanks for the tutorial & the help!!). On loading the spritesheets, I had ... .convert_alpha ... instead of .convert_alpha()
      Yeah, missed parenthesis is a thing. This caused the error of not understanding the subsurface reference.

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

      @@thewebexpert3311 I just checked your code and came back here to reply to you about the parenthesis. Glad you got it figured out already. It's often those little things that cause these strange errors.

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

    You are going to be big one day! Remember me when your famous

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

    how would I go about adding a delay to when the attack rectangle appears if the attack animation were to have some windup before the person throws the punch?

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

    I followed the steps around 28:45 but my character still only jumps once. What can the reason be to it not working? Different screen heights/width?

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

      If the character can jump once but then isn't able to jump again then it's likely that the jumping variable isn't being reset when the character lands back on the ground so there could be a misspelled variable or something missed out. The source code is linked in the description, have a look at that and see if you can spot what might be causing the issue.

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

      @@CodingWithRuss I found it! It was that i had "self.jump == False" instead of "self.jump = False" which only has one =. Thanks for the feedback! You are a MASSIVE help :DD

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

    please help, I keep getting a ValueError and it says the subsurface rectangle is outside the surface area. How do i fix this I have been stuck on this for 3 hours now. 1:07:23 onwards from when you run it. How do i fix this error

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

      Hey, is your attack func working properly?

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

      @@namandixit6358 it works but after I press the attack button it freezes?

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

      Hello! Did you find a solution? Im stuck on the same thing :/

  • @pogotv-hindistories5659
    @pogotv-hindistories5659 Год назад

    line 2, in
    from fighter import Fighter
    ModuleNotFoundError: No module named 'fighter'
    I am get this error at timestamp 13:26
    Please help me resolve it and reply ASAP

    • @pogotv-hindistories5659
      @pogotv-hindistories5659 Год назад

      Sharing my code with you till timestamp 13:26
      import pygame
      from fighter import Fighter
      pygame.init()
      #create game window
      SCREEN_WIDTH = 1000
      SCREEN_HEIGHT = 600
      screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
      pygame.display.set_caption("Brawler")
      #load background image
      bg_image = pygame.image.load("assets/images/background/background.jpg").convert_alpha()
      #function for drawing background
      def draw_bg():
      scaled_bg = pygame.transform.scale(bg_image, (SCREEN_WIDTH, SCREEN_HEIGHT))
      screen.blit(scaled_bg, (0, 0))
      #create two instances of fighters
      fighter_1 = Fighter(200, 310)
      fighter_2 = Fighter(700, 310)
      #game loop
      run = True
      while run:

      #draw background
      draw_bg()
      #draw fighters
      fighter_1.draw(screen)
      fighter_2.draw(screen)
      #event handler
      for event in pygame.event.get():
      if event.type == pygame.QUIT:
      run = False
      #update display
      pygame.display.update()
      #exit pygame
      pygame.quit()
      this is happening even when I created the fighter class

  • @NN-uy6ik
    @NN-uy6ik 2 года назад +1

    Super nice tutorial, thank you so much for this video

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

    hello How do you do for know where is the valew of the ground at 26:20 and where we can change that?

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

    Dude This is really awsome

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

    Also started to program Street Fighter II: The New Challengers as a text-based fighting game while running into the 'problem' that Zangiev bugs out into screwdriving everyone into insanity...haha

  • @danilodimitrijevic1778
    @danilodimitrijevic1778 10 дней назад

    I have a question when you were loading the warrior sprites were they all in one picture or were they all in one folder becouse if they were all in one picture you wouldn't be able to go thru them,am I wrong?

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

    So, I'm trying to add a blocking component, (even though there is no animation), I have it so far that the target doesn't receive damage when blocking, but How can I make it that they cannot move while blocking? I tried to reset it to "False" like the running variable, but that resets it automatically and makes them invincible while holding it...

  • @KD-hi3ur
    @KD-hi3ur 2 года назад +2

    how did you combine the fighters PNGs? I want to add new fighters but don't know how

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

    So cool really like coding thanks for the tutorial

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

    Great video, thanks!!

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

    hello, i have a problem with the drawing of the character because i draw him in a group with a tiled map and there are not argument in the self.group.draw() if it's not the screen to apply an offset so my character rect is not on him.
    Did you have a solution to apply an offset in a group ?

  • @TruongTanat_A
    @TruongTanat_A 8 месяцев назад +1

    Hi bro, can you show me how to create an image that includes all the character's actions?

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

    This is awesome...thanks for sharing this step-by-step tutorial. Btw, creating all of the code, how do you package the code into an executable file?

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

      Thanks, glad you like it! I have a tutorial on converting to exe here:
      ruclips.net/video/2X9rxzZbYqg/видео.html

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

      @@CodingWithRuss - Great!! Thank you. Will check it out.

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

    When player1 goes to the otherside of player2 the image flips correct. My image flips but there is a slight offset to the flipped image. Is there a way to fix this?

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

    Bro this is cool thanks man.

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

    I am trying to do the spritesheet loading but the white background from the images still appears, how would I remove that?

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

    Are you drawing the images yourself? Or do you have a graphics artist you pull images from? Looks good

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

    Awesome 🔥🔥

  • @ayotundealabi7843
    @ayotundealabi7843 5 месяцев назад +2

    the image is giving me problem because it can not find it so i usedC:\Users\hp\Desktop\adel\coding'.

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

    hi i have a problem with this part of code: temp_img = sprite_sheet.subsurface(x * self.size, y * self.size, self.size, self.size) python say he cant know what is the subsurface

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

    How did you get all the sprite sheets into just one sprite sheets. I have the individual ones for the fighter actions but can't merge them into one image

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

      You can use image editing software for that like photoshop. I used GIMP because it's free

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

      @@CodingWithRuss how did you merge all the sprite sheets together. All the methods I have found are all from several years ago and outdated.

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

      @@joshuao174 Did you try using GIMP? You just open up each image then copy and paste them all onto one big image.

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

    Like what should I do to compile the sprite sheet and also I keep getting this error like subsurface rectangle outside surface area, and idk how to fix that

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

    I have a problem when I use the attack button and a direction button is still pressed. Animation freezes in sprint mode and it is not possible to control the fighter again. Where did I go wrong?

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

      Hi Felipe, I tested out my version to see if I have the same bug and it works fine here. Sounds like maybe a typo or a missed piece of code in the section that handles the different actions. Take a look at the source code in the video description for a comparison and see if that helps you find the error.

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

      @@CodingWithRuss I refactored your original code a bit but I inserted some bugs.. :( I already fixed it by setting self.running to false. but I wasn't very pleased with my solution

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

    This is awesome!!

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

    This is insane thank you for share

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

    Amazing. Is there a way to load sprites and animations if its separate sprite sheets? i.e a sprite sheet for walking may have 5 sprites, sprite sheet for running may have 8 etc..... Sometimes its hard to combine separate sprite sheets as one to get all the spacing right etc

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

    You explain very well

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

    YES this is awesome

  • @mr.goldenweek8463
    @mr.goldenweek8463 2 года назад +1

    im so happy !!!!!! thx thx thx i love you so much

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

    nice work :D

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

    Excellent video

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

    Anyone else had an issue where it wouldn't go through the images? All the movement logic and attacks work just fine, but the characters are just static images of the first frame of the idle animation. I've redone the animation and image sprite loading part multiple times, but to no avail. If anyone had this problem and has any tips on how to resolve it, it would be greatly appreciated.

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

    This is awesome! Would you say I would be able to use this program to make a full feldged game with like super meter and stuff like that?

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

      Thanks! Yes I don't see why not. Pygame is very versatile so you can add a lot of features to a game.

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

    can you do a tutorial where there is a title screen and you can select characters like super smash bros? im really looking forward for the video because this tutorial was a huge success i want to see new characters and a title screen which will really make it fun to play. Again thank you for the awesome tutorial!!!