I like how you break it down from the beginning in each video series so people can start on any series in the channel and feel comfortable. For someone like me, who's watching all the videos sequentially, you're reinforcing the foundations again and again, which is helping them stick. Meanwhile if we're revisiting something I feel confident about, I'm either trying to get ahead of you while the video plays, to quiz myself, or thinking about how I'm going to be combining these concepts on my personal projects and trying to identify potential obstacles there. I'm excited to get all the way through your PyGame and python content and move on to Godot. I honestly didn't plan on learning Godot at first, but now I'm thinking I'll try it out.
any one who is learning python dont check any other tutorial , just follow this coding with Russ and watch this tutorial you will learn every thing in a most fun way. i have been watching a lot of useless tutorials that wasted my time. i dont know why i found this great guy so late who is explaining every single thing in detail. thumbs up coding with Russ.
I don't know if you will see this but I LOVE LOVE LOVE the way you explain things so well and in a timely manner, I have only finished the second video but I noticed that every time something is wrong it is because I did something wrong lol Other tutorials will mess up and leave me confused and no way to figure out how its supposed to look
Thanks! I'm glad to hear it :). That's also why I include the source code for each video in the description because it can be really frustrating not being able to figure out what the problem is when you make a small mistake.
Many thanks for this series. I'm just starting with my first pygame game and I was so happy to actually see my character moving around :D I am actually doing a bit of a different type of a game (something sort of The Binding of the Isaac you could say), so my character is moving also upwards and downwards. However I guess the easier part in my case it's that my character won't be doing any jumping😃 Also I was lucky to get the images of my character facing upwards downward left and right so I just changed the image of my character with each movement instead of creating this flip function as you did. Looking forward for next steps. Thanks again :)
hello can i ask about the image how did you do that when I'm trying to do that I get such errors and also I already downloaded your files on github but still cant do that can you help me?
could you show us how to make a leaderboard? trying to make one that would work with sql (for example in the platformer game it takes the time the player beat the game in)
how do I download the whole Img folder because i cannot do that and now all my seperate images are just random and i can't call them with the char_type function
Hi! I had the same problem as you, but hoeray! I fixed it! Here is the solution! You have to go to the github link in the discription, and click on: "code", the green button and click on: "Download ZIP". After you done that, open the folder/ZIP and click *once* with your mouse on the "img" folder. Click: Ctrl + c, or click with your right mouse button and click "copy". Then go to your folder where your code is at, and click: Ctrl + v, or click with your right mouse button and click "paste". The code should work now. Have a nice day, @Sid_MC
Hello, I think there is a minor issue when you press the the key "A" and "D" , that behavior will be turn right only. I set "moving_left" and "moving_right“ as i "-1" and "1" when pressing the key, then "direction = moving_left + moving_right". I will test the boolen value of "direction", if it's true, then assign the dx = direction * speed , and "self.flip = direcion < 0"
@@grazoryt Sorry, I didn't watch youtube recently and I just saw your question. The "issue" I mentioned is "the two if statements" that set the dx value, the second one will overwrite the first. So I made them into one statement, that is "dx = speed * direction“, and the direction is not boolean value, but a integer vaule that is a sum of "left + right" (I set moving_left = -1, and moving_right = 1). I tried this tutorial 4 months ago, I don't remember what I did clearly, if you want to debug why your solider not moving, I just advice you print some value ( speed, the moving_left and moving_right).
@@yasmeteora8508 thank you for spending your time and explaining me but after few days i did resolvethe issue and its now working fine.If u still have the code for this game please reply with the full code bcoz i have some issue called soldier not assosiated with draw, i still didnt finish the full code im still i the 3rd part of the video...
How could I get that move configuration work for a 2 player game in the same PC? Can't find any answers and have been trying a lot of stuff unsuccessfully
You could try adding extra keys to the event handler for player 2 and then add extra variables for player 1 and player 2 movement so the code knows which player is moving.
Yea it's the folder name and it will also tie into the action the player is doing. It will make more sense in later videos as I add different animation types
Hi I’m doing an assignment for school and using this tutorial and so far it’s been really great but for some reason in the same line when I press f it appears in the text string instead of just being f and so does the {self.char_type} sorry if it’s a bit hard to understand what I’m saying. But if I could get some help that’d be great. For example at about 18:10 when you type the f it’s blue but when I do it it joins the string and is yellow. That’s the same when you write the {self.char_type}
I could not get the "img = pygame.image.load(f'img/{char_type} /Idle/0.png')" to work so I changed it to "img = pygame.image.load(os.path.join("img",char_type, "Idle", "0.png"))" which so far appears to work
I can't get this line to work. img = pygame.image.load(f'img/{self.char_type}/Idle/0.png') I made sure the destination path for the images was right too! It keeps saying no such file or directory! Please help! I'm using Pycharm BTW!
In python IDLE, I don't think you can open an image from outside the python project's folder. And because of this, I don't know what to do instead of img = pygame.image.load(f'img/{self.char.type}/0Idle.png')
struggled with an indentation issue for hours that caused my player to go down instead of right, gpt fixed for me what i could not spot humanly at all. i followed the git-structions along with this tutorial, line for line. everything looks okay but isn't. thanks for the video.
I have the same issue. Can't find the mistake. How did you fix it? Edit for those who need it: found the mistake. The #keyboard_pressed section should say event.key, not event.type. Just some stupid typo
Really amazing video! I am wondering what if we used something like Tim from 'Tech with Tim' does like keys = pygame.key.get_pressed() I believe as long as the keys still held in next loop it will continue to move and if it is not within the next iteration pygame will know its key up.
Thanks! I did use that method in some of my other games including my previous platformer. In this shooter I wanted to see if I could put all the controls in the event handler in the main loop instead, just to experiment with different approaches. In my newer games I have gone back to the method you mentioned as I find it easier.
go through each line of your code in that section again. sometimes when you reuse(copy paste) code there are things u might have missed to change for the a key. if event.type == pygame.KEYDOWN: if event.key == pygame.K_a: moving_left = True if event.key == pygame.K_d: moving_right = True make sure its the same as above and it should work :)
I'm not sure if I'm doing something wrong, but It gives me an error saying that moving_left and moving_right aren't defined. I think my code matches yours, but I don't know what's wrong. The only way for me to fix it is to predefine moving_left and moving_right before loading anything else, but I think that lags out the program somehow, since the program is very laggy.
Nevermind, I figured out what the problem was. as it turns out, if you don't add in the "pygame.quit()" at the very end, it totally lags out the whole program.
is there any other way to open multiple photos , i mean without this f {} (the char type ) because not working for me and i want to open the enemies please help "!!!
You may have an older version of python so you can update it and f{} will work for you. Otherwise you can still use .format() instead. It works in a similar way but you may need to look up the documentation to see how to use it
I do that so i can specify the char_type and the code loads either the player or enemy images. If you put the name of the folder in manually then it will only be able to load that image. If it isn't working for you then you might be using an older python installation that doesn't support f string formatting. Try updating your python install and it should work.
Hello, I found the folder from your github the name of "Idle" for player the first letter is upcase, but the enemy's lowcase. I just rename it manually to solve the issue
@@yasmeteora8508 Thanks for pointing this out. It didn't cause any issues for me but seems for some people it gives errors. I have updated the folder names on github now
@@CodingWithRuss i am also facing the same issue please help me in this class soldier(pygame.sprite.Sprite): def __init__(self,char_type, AD, PD, scale, speed): pygame.sprite.Sprite.__init__(self) self.char_type = char_type self.speed = speed self.direction = 1 self.flip = False img = pygame.image.load("ct.png") self.image = pygame.transform.scale(img, (int(img.get_width() * scale), int(img.get_height()* scale))) self.rect = self.image.get_rect()
These tutorials are good but they are outdated, you need to make these in 2022 again because of people that started this years. Updates have changed the programs.
if event.type==pygame.KEYDOWN: if event.key==pygame.K_a: move_L==True if event.key==pygame.K_d: move_R==True if event.key==pygame.K_ESCAPE: run==False if event.type==pygame.KEYUP: if event.key==pygame.K_a: move_L==False if event.key==pygame.K_d: move_R==False is not working
Part 3 uploaded, in which I show how to add different animations to the characters. Check it out here: ruclips.net/video/Su5OlLSpJDU/видео.html
I have an error, when I move my character, it goes to the spawn point and moves
Yay! I love it when it comes to animations!
I like how you break it down from the beginning in each video series so people can start on any series in the channel and feel comfortable. For someone like me, who's watching all the videos sequentially, you're reinforcing the foundations again and again, which is helping them stick. Meanwhile if we're revisiting something I feel confident about, I'm either trying to get ahead of you while the video plays, to quiz myself, or thinking about how I'm going to be combining these concepts on my personal projects and trying to identify potential obstacles there.
I'm excited to get all the way through your PyGame and python content and move on to Godot. I honestly didn't plan on learning Godot at first, but now I'm thinking I'll try it out.
any one who is learning python dont check any other tutorial , just follow this coding with Russ and watch this tutorial you will learn every thing in a most fun way. i have been watching a lot of useless tutorials that wasted my time. i dont know why i found this great guy so late who is explaining every single thing in detail. thumbs up coding with Russ.
Thanks so much, that's really kind :) Glad you like the tutorials.
Russ, these videos are just amazing, thanks for everything you do! Merry Christmas my friend!
Thanks a lot! Merry Christmas to you too :)
I don't know if you will see this but I LOVE LOVE LOVE the way you explain things so well
and in a timely manner, I have only finished the second video but I noticed that every time something is
wrong it is because I did something wrong lol
Other tutorials will mess up and leave me confused and no way to figure out how its supposed to look
Thanks! I'm glad to hear it :). That's also why I include the source code for each video in the description because it can be really frustrating not being able to figure out what the problem is when you make a small mistake.
The best programming channel ever i thin the next part will be after 2 days
Thanks 😀. Yes I plan to upload it every 2-3 days
@@CodingWithRuss And can you do exe from it? Make a video how to do exe from this game please.
@@CodingWithRuss Where is part 3
Many thanks for this series. I'm just starting with my first pygame game and I was so happy to actually see my character moving around :D I am actually doing a bit of a different type of a game (something sort of The Binding of the Isaac you could say), so my character is moving also upwards and downwards. However I guess the easier part in my case it's that my character won't be doing any jumping😃 Also I was lucky to get the images of my character facing upwards downward left and right so I just changed the image of my character with each movement instead of creating this flip function as you did. Looking forward for next steps. Thanks again :)
Glad you found this useful. Your project sounds really cool! Good luck with it :)
Completed your coin collecting game tutorial and now onto this one. Love these and thank you for creating them!
Thanks 🙏🏻
This helped me a lot
Now you have a new subscriber
Thanks for the sub!
Thanks a lot!
Its very inspiring, to do something, and see the results that soon.
Thank you, glad you liked it!
this is gold thank you brother
Fantastic!!.. What a great Tutorial.
Thanks, glad you liked it!
kudos to you, great content! you earned a sub😉😊
Man you're awesome, thanks!!
Thanks, glad you like the vids :)
Very nice game, I LOVE it! Please make more videos like this. You earned a SUBSCRIBE!!
This tutorial is great 👍🏾
Glad you liked it
hello can i ask about the image how did you do that when I'm trying to do that I get such errors and also I already downloaded your files on github but still cant do that can you help me?
How do I make the character flip when moving up and moving down
Best tutorial 👌
Good stuff
Amazing video
Where i put {char_type} because my img 0.png is in ('F:\Softwares\Visual studio\Saves\Shooter\Shooter/0.png') pls tell me where
could you show us how to make a leaderboard? trying to make one that would work with sql (for example in the platformer game it takes the time the player beat the game in)
That's a good idea! I haven' done that in this game but that's something I could look at for a future tutorial
subscribed. more please!
Thanks! Just started uploading another series yesterday and more to follow
how do I download the whole Img folder because i cannot do that and now all my seperate images are just random and i can't call them with the char_type function
Hi! I had the same problem as you, but hoeray! I fixed it! Here is the solution!
You have to go to the github link in the discription, and click on: "code", the green button and click on: "Download ZIP". After you done that, open the folder/ZIP and click *once* with your mouse on the "img" folder. Click: Ctrl + c, or click with your right mouse button and click "copy". Then go to your folder where your code is at, and click: Ctrl + v, or click with your right mouse button and click "paste". The code should work now.
Have a nice day,
@Sid_MC
Hello, I think there is a minor issue when you press the the key "A" and "D" , that behavior will be turn right only. I set "moving_left" and "moving_right“ as i "-1" and "1" when pressing the key, then "direction = moving_left + moving_right". I will test the boolen value of "direction",
if it's true, then assign the dx = direction * speed , and "self.flip = direcion < 0"
can you explain more clearly bcoz my game is now stuck and not moving when i press a or d
@@grazoryt Sorry, I didn't watch youtube recently and I just saw your question. The "issue" I mentioned is "the two if statements" that set the dx value, the second one will overwrite the first. So I made them into one statement, that is "dx = speed * direction“, and the direction is not boolean value, but a integer vaule that is a sum of "left + right" (I set moving_left = -1, and moving_right = 1). I tried this tutorial 4 months ago, I don't remember what I did clearly, if you want to debug why your solider not moving, I just advice you print some value ( speed, the moving_left and moving_right).
@@yasmeteora8508 thank you for spending your time and explaining me but after few days i did resolvethe issue and its now working fine.If u still have the code for this game please reply with the full code bcoz i have some issue called soldier not assosiated with draw, i still didnt finish the full code im still i the 3rd part of the video...
@@grazoryt Sorry, I deleted my code after I gave up this tutorial.
@@yasmeteora8508 oh loll
good job. thank you for all
Is char_type for 3.9 version only?
the f string method was added in python 3.6 so should work with any versions after that
Hmmm my pc is always sus
nice video keep it on
Thank you, I will
What is the name of the background color, for the RGB value you choose?
How should i put the folders for the img = pygame.image.load(f'img/{self.char_type}/Idle/0.png')?
Copy the folder structure that is on github since that's how it is setup in the code
How could I get that move configuration work for a 2 player game in the same PC? Can't find any answers and have been trying a lot of stuff unsuccessfully
You could try adding extra keys to the event handler for player 2 and then add extra variables for player 1 and player 2 movement so the code knows which player is moving.
sir the char//-type code is not working
Hey there im new to coding what application are you using to create this game on. Thanks
Hi, I use sublime text for these games.
Really like it but just 1 question, is there any good site to get those simple pixel characters?
itch.io is pretty good, other than that I just google open source images
@@CodingWithRuss tysm for fast response :)
thanks good vidéo
Thanks
Please can anyone explain to me the directory thing the self.(char_type)
Hello, in the part of the code that reads (f"img/{self.char_type}/Idle/0.png") what is Idle, is it the folder the picture is in.
Yea it's the folder name and it will also tie into the action the player is doing. It will make more sense in later videos as I add different animation types
@@CodingWithRuss Okay, thank you. I was struggling a bit trying to find out what that was.
Hi I’m doing an assignment for school and using this tutorial and so far it’s been really great but for some reason in the same line when I press f it appears in the text string instead of just being f and so does the {self.char_type} sorry if it’s a bit hard to understand what I’m saying. But if I could get some help that’d be great.
For example at about 18:10 when you type the f it’s blue but when I do it it joins the string and is yellow. That’s the same when you write the {self.char_type}
Is it because I haven’t set up my folders or something?
Nvm I was being silly haha sorry
I could not get the
"img = pygame.image.load(f'img/{char_type} /Idle/0.png')"
to work so I changed it to
"img = pygame.image.load(os.path.join("img",char_type, "Idle", "0.png"))"
which so far appears to work
Nice, that's a good alternative for it
I can't get this line to work.
img = pygame.image.load(f'img/{self.char_type}/Idle/0.png')
I made sure the destination path for the images was right too!
It keeps saying no such file or directory!
Please help!
I'm using Pycharm BTW!
Idk
@@Ganga-Harshith-Mylapuram Nevermind, I fixed it.
@@nikhildodley1669 Glad you got it fixed. What was the problem?
@@CodingWithRuss Didn’t create an enemy folder yet
非常感谢
In python IDLE, I don't think you can open an image from outside the python project's folder. And because of this, I don't know what to do instead of img = pygame.image.load(f'img/{self.char.type}/0Idle.png')
I never really used IDLE, why not try an IDE? I use sublime text editor in these videos
@@CodingWithRuss I use visual studio code but still its not working
@@HimanshuSingh-yv9qj I'm not overly familiar with VS code. You may need to do additional setup to load in the images.
its because if you open the folder you can see that its named 1idle.png not 0idle.png, just fix that and then it will work
struggled with an indentation issue for hours that caused my player to go down instead of right, gpt fixed for me what i could not spot humanly at all. i followed the git-structions along with this tutorial, line for line. everything looks okay but isn't. thanks for the video.
char type doesnt work. using 3.9.6 version python.
Just giving an Idea, instead of calling this "Shooter" I called this "Lost_In_War" Which I find cooler, just a cool name idea!
Nice name! I should have tried to be more creative than "Shooter" :D
My player image is moving backward but not forward....please somebody help
Sounds like a typo in your movement code. Have a look at the code in the video description and compare - it will help you find the issue
I have the same issue. Can't find the mistake. How did you fix it?
Edit for those who need it: found the mistake. The #keyboard_pressed section should say event.key, not event.type. Just some stupid typo
Hey for some reason I can move left but then once I press d to turn right I can't turn left again,
Someone pls help me.
in my system it say speed not defined
what should i do
i copied the whole thing yet my keyboard buttons are not working, i don't know why, please help
Really amazing video! I am wondering what if we used something like Tim from 'Tech with Tim' does like keys = pygame.key.get_pressed() I believe as long as the keys still held in next loop it will continue to move and if it is not within the next iteration pygame will know its key up.
Thanks! I did use that method in some of my other games including my previous platformer. In this shooter I wanted to see if I could put all the controls in the event handler in the main loop instead, just to experiment with different approaches.
In my newer games I have gone back to the method you mentioned as I find it easier.
Sir, what software did you use for the project?
@@The_Piano_Guy49 Ok, thanks!
Thanks sir but i have a question, in class you wrote self.speed and blah blah but how does the computer know that u are referring to speed
The computer doesn't know what any of the variables mean. It is what you do with the variables in the rest of the code that determines what happens.
@@CodingWithRuss so if im making this game for phone with buttons how do i rotate the window horizontally
Save my time Stamps 9:33
Ive coded this part exactly the same but when i press the a key my player doesnt move but when i press the d key it does. how do i fix this?
go through each line of your code in that section again. sometimes when you reuse(copy paste) code there are things u might have missed to change for the a key.
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_a:
moving_left = True
if event.key == pygame.K_d:
moving_right = True
make sure its the same as above and it should work :)
I'm not sure if I'm doing something wrong, but It gives me an error saying that moving_left and moving_right aren't defined. I think my code matches yours, but I don't know what's wrong. The only way for me to fix it is to predefine moving_left and moving_right before loading anything else, but I think that lags out the program somehow, since the program is very laggy.
Nevermind, I figured out what the problem was. as it turns out, if you don't add in the "pygame.quit()" at the very end, it totally lags out the whole program.
Glad you got it working!
is there any other way to open multiple photos , i mean without this f {} (the char type )
because not working for me and i want to open the enemies
please help "!!!
You may have an older version of python so you can update it and f{} will work for you. Otherwise you can still use .format() instead. It works in a similar way but you may need to look up the documentation to see how to use it
Do you have to add {self.char_type} because when i typed that I got an error. I only added the name on the picture and that works.
I do that so i can specify the char_type and the code loads either the player or enemy images. If you put the name of the folder in manually then it will only be able to load that image. If it isn't working for you then you might be using an older python installation that doesn't support f string formatting. Try updating your python install and it should work.
Hello, I found the folder from your github the name of "Idle" for player the first letter is upcase, but the enemy's lowcase. I just rename it manually to solve the issue
@@yasmeteora8508 Thanks for pointing this out. It didn't cause any issues for me but seems for some people it gives errors. I have updated the folder names on github now
@@CodingWithRuss i am also facing the same issue please help me in this
class soldier(pygame.sprite.Sprite):
def __init__(self,char_type, AD, PD, scale, speed):
pygame.sprite.Sprite.__init__(self)
self.char_type = char_type
self.speed = speed
self.direction = 1
self.flip = False
img = pygame.image.load("ct.png")
self.image = pygame.transform.scale(img, (int(img.get_width() * scale), int(img.get_height()* scale)))
self.rect = self.image.get_rect()
i got the enemy but the colour is same please help in this... @coding with Russ
Sir Pls send other parts fast
Coming soon :)
спасибо
You're welcome
@@CodingWithRuss я попробовала сделать игру по вашим туториалам и у меня почти вышло. огромное вам спасибо!
when i press a it goes left but when press d it does flip but not move pls helpppp
nvm for some reason it was fixed idk how
Я хоть и не понимаю по английски, но понимаю о чем ты говоришь
my player lags alot before moving how do i fix it? anyone?
These tutorials are good but they are outdated, you need to make these in 2022 again because of people that started this years. Updates have changed the programs.
if event.type==pygame.KEYDOWN:
if event.key==pygame.K_a:
move_L==True
if event.key==pygame.K_d:
move_R==True
if event.key==pygame.K_ESCAPE:
run==False
if event.type==pygame.KEYUP:
if event.key==pygame.K_a:
move_L==False
if event.key==pygame.K_d:
move_R==False
is not working
I am making it for the first time but i cant seem to fix the error:
Module button not found,
Please help me
This part of the tutorial doesn't use buttons. Are you following the videos? They explain everything step by step.
how can i view the code with the link. it doenst work
I've updated the links so should be OK now.
What’s the IDE did you use here?
Sublime Text
you can follow this with anything, i'm using visual code
I don't know but PyCharm is also good
Where is part 3???
Just uploaded it :)
yo whats {self.char_type}?
It's a variable for "character type" which I use to tell the difference between the player and the enemies.
@@CodingWithRuss thanks
@@CodingWithRuss its still not working idk if its outdated lol
@@JJr1012 No the code should work fine, it's not outdated
@@CodingWithRuss oh
10:01
0:20
Someone really did get 10 bucks just copying this? 😂
.