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!
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.😊
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... 💜
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 👏
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!
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.
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
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!
@@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)
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 :)
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.
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! 😄
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
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!
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.
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!
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
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
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
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.
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?
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
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?
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?
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
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!!
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
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!
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?
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?
@@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"
@@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.
@@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
@@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.
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.
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
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?
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.
@@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
@@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
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
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.
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.
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.
@@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.
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?
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.
@@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
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
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
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
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
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?
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...
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 ?
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?
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
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
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
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?
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.
@@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
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
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.
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!!!
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!
That sounds great! You're welcome to download and use the code as you like. Good luck with your projects.
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.😊
Thank you, that's great to hear :) Glad the tutorials have been helpful
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... 💜
Thanks, I'm glad you liked it!
The fact that it's a praise from captain Levi makes it even more honourable
You do not get a course about just programming a game, also about how to structure your project. Very good Tutorial
Thank you, glad you like it
Great Video...Is this Code available ?
@@HURRY-UP-N-BUYyes check the description
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 👏
Thanks a lot! :)
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!
Thanks, glad to hear it was helpful!
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.
Thank you! That means a lot :)
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
Glad to hear it :) Hopefully it's clear and easy to follow!
Thank you for making such a high quality tutorial for free - you are the best pygame teacher I have seen
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
Thanks! Glad to hear the tutorials helped you out :)
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!
Thanks! Glad you liked it. It's really cool to see what additional features people add into these games.
do you have the whole code, id be interested in looking at the whole thing
@@rozenoce if you're curious... ruclips.net/video/WsIm0Tq6Az0/видео.html
Did you manage to implement more characters in the street fighter clone?
@@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)
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 :)
Glad to hear the video was useful!
This is incredible!
Verified user 👏
C'est incroyable pour toi Russ
Thanks!
@@CodingWithRuss :D
You are a legend and a master to many people around the world who are learning to code, W human being
Thanks for the kind words :) Glad you like the videos.
This looks amazing! Can't wait to get started on it.
Someone give this guy some credit, this is amazing!
Cheers :)
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.
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!
I also had a question. Do you think people should still learn pygame or is there advantages to learning godot instead?
Thanks for taking the time and making this amazing video mate 🚀
Glad you liked it!
It was my dream to make a game like street fighter. And see today because of you i can. Thanks a lot for this.
No problem! Glad to hear the video helped
Finished the game with some additional features, Thanks brother
Nice one!
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! 😄
Thank you! Glad to hear you made your first game :)
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
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.
Thanks, glad to hear it helped
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!
Thanks, glad it was useful!
How do you do that tho? Is it not recomended for Beginner?
did you manage to make the AI?
OMG ITS WORKED. Guys it really worked. Thank you
Of course :)
Excellent tutorial, clearly explained from start to finish!
Thanks!
I love this channel!! So glad I found it.
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!
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.
@@CodingWithRuss Yeah, I definitely am and you’re helping out a lot. Keep it up man!
this is one of the best tutorials ever
Thanks, glad you like it
I am very glad that I stumbled upon your video
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!
I'm a beginner of python, thank u very much for make this video!!!!!
You're welcome, glad it helped!
Tutorials are getting better and better!!!!! Thanks for all the knowledge.
Thank you! Glad you like it
Hello Teacher , thank you for this wonderful tutorial
Thanks, glad you like it
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
Thanks, glad it helped!
Well done! I followed along and learned a lot. Great tutorial.
Glad it was helpful!
Really nice video. Thanks to you I was able to do my project for OOP lecture.
Glad to hear it was helpful!
All of your videos are so good I can’t even explain, I’ve learned so much just from these videos
Thank you
🎉🎉
Thanks! Glad you found them useful :)
great tutorial man. thank you for making this. i learned a lot more from this video than my teacher taught me.
Thanks! Glad to hear you found it useful
Thanks Russ, this helped me a lot!!
Glad to hear it!
Great tutorial. You still remain one of the best to follow.
Thanks Harry
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?
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
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
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.
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?
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
@@fernandoanholon1141 now I'm stuck, can I get help! :)
@@ayshasaifalkaabi what's happening?
This is absolutely brilliant!!!
Thanks!
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?
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?
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
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!!
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
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!
Ur channel is so precious. Thank u and pls keep going 🙏❤️
Thanks :)
Oh my oh my! It's like a show on a streamer man!
Hey Russ....wow thanks a lot....can't wait to start this tutorial.....
You're welcome!
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?
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?
@@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"
@@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.
@@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
@@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.
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.
I SOLVED IT. I just changed to ur sprite sheet it was the frames.
Ah nice, glad you got it working
helloooooooo I have a question in minute 13:27 the rectangles arent appearing on my screen
thank you so much for creating these videos :)
Glad you liked it :)
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
That's amazing! next a beat em up maybe? I'd love that!
That would be pretty cool actually, I loved those games as a kid!
Hi Russ, love the video! If you make the second part, then you want to have the opportunity to choose a hero / arena
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?
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.
@@CodingWithRuss You were right, thank you so much!
@@theh0llowkn1ght74 Glad to hear you got it working!
@@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
@@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
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
i am still able to click r and T to attack but a w and d have no output
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.
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.
@@CodingWithRuss I sent you my code via email. I am still stuck in the same spot.
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.
@@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.
You are going to be big one day! Remember me when your famous
Thanks!
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?
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?
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.
@@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
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
Hey, is your attack func working properly?
@@namandixit6358 it works but after I press the attack button it freezes?
Hello! Did you find a solution? Im stuck on the same thing :/
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
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
Super nice tutorial, thank you so much for this video
Thanks, glad you liked it.
hello How do you do for know where is the valew of the ground at 26:20 and where we can change that?
Dude This is really awsome
Thanks
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
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?
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...
how did you combine the fighters PNGs? I want to add new fighters but don't know how
So cool really like coding thanks for the tutorial
You're welcome
@@CodingWithRuss np
Great video, thanks!!
Cheers!
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 ?
Hi bro, can you show me how to create an image that includes all the character's actions?
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?
Thanks, glad you like it! I have a tutorial on converting to exe here:
ruclips.net/video/2X9rxzZbYqg/видео.html
@@CodingWithRuss - Great!! Thank you. Will check it out.
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?
Bro this is cool thanks man.
Glad you like it
I am trying to do the spritesheet loading but the white background from the images still appears, how would I remove that?
Are you drawing the images yourself? Or do you have a graphics artist you pull images from? Looks good
Awesome 🔥🔥
Thanks!
the image is giving me problem because it can not find it so i usedC:\Users\hp\Desktop\adel\coding'.
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
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
You can use image editing software for that like photoshop. I used GIMP because it's free
@@CodingWithRuss how did you merge all the sprite sheets together. All the methods I have found are all from several years ago and outdated.
@@joshuao174 Did you try using GIMP? You just open up each image then copy and paste them all onto one big image.
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
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?
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.
@@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
This is awesome!!
Thanks!
This is insane thank you for share
Thanks!
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
You explain very well
Thanks
@@CodingWithRuss nvm I fixed it
YES this is awesome
Glad you like it!
im so happy !!!!!! thx thx thx i love you so much
nice work :D
Thanks :)
Excellent video
Thanks
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.
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?
Thanks! Yes I don't see why not. Pygame is very versatile so you can add a lot of features to a game.
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!!!