Gonna be 100% honest with you. The way you are programming this game is perfect! Use of classes allows for easy reuse of code. And having a config script keeps the main script clean and organized! I love it! 😍
Want to make mobile apps with python? Check out this video --> ua-cam.com/video/7oMNqAE_OVE/v-deo.html I hope you found the first tutorial in this series useful! If you would like to see the next tutorials, then be sure to SUBSCRIBE so you don't miss out! Also, be sure to share this video with anyone who would find it useful!
Very excited to revisit pygame. We made a game on it in college but I can't remember much. I'm getting into programming again and am thrilled to have come across such a nicely formatted tutorial series. Thanks man!
I’m a few videos in and I realy have to say thank you. Seeing this stuff implemented and you explaining it as you do it, is fway more useful than any py basics. This is making this stuff click for me like nothing else has. Thank you very much.
I'm using these videos to learn python for a school project, and they are perfect! I only discovered this channel today but I hope you come back! Thank you!!!!!
Hey there! This is one of my most favourite tutorials. You are concise and explain everything in the perfect amount of detail. One tip for you is to use Vscode (visual studio code) since the software automatically tells you if there are any bugs or things missing. Thanks for the tutorial.
This is exactly what I needed. Not saying I'll ever make a game using pygame, but it is good practice to program a game from scratch outside of an IDE/program. Thanks for this tutorial.
the most valuable thing in programming i think is: the yx,or xy loop. y=0 x=0 end=10 while y != end: x=0 while x != end: x=x+1 y=y+1 you can use it for grids,files ,anything that uses columns and rows. and loop trough them. ofc in 3d,you also add z. now its not useful by itself. but add in string-substitution ,the split(),and strip() methods,+ reading/writhing files, and lists[][]. and you have a whole lot of power in your hands. i also use os.system("dir /b c:\location > file.txt"), a lot on windows ,to scan directories. this is a CMD command. and then use the yx/xy loop to get its contents like so: file=open("file.txt","r"") for lines in file.readlines(): lines=lines.strip() list=lines.split("delimiter") for word in list: word=word file.close()
Hello, I started to learn python last month and I feel that there is something wrong with my learning ways. Do you have any idea where can I enhance my Fundamental skills and also python skills. I cant think of an amazing and fun projects that can enhance my skills.
I have a Python Basics series that teaches you the fundamentals of python. There are also challenges at the end of each video to test what you have learned: ua-cam.com/play/PLkkm3wcQHjT7Seo5VeYwEMNP4TEzr5rBu.html
I really admire that not only was the coding detailed and neat, but you explained it clearly and made it easy to understand :D although if you haven't done so already and are ok with me asking, could you possibly do an inventory available to the player once they collect items, as well as features that alter the players strength or stuff like that? For example: +2 luck or +8 crit damage
Thanks! I won't be doing any more Pygame RPG tutorials, but an inventory system would probably just be a list in the Player class, and items are added when they are collided with. The player strength and crit damage would also just be variables in the player class, and the items in the inventory list could alter them.
Hi, i'm trying tô make the character walk but i'm stuck, can you help me? I tried to create a def walk within the Player class and create a event.type within the def events
so i copied your code and it won't run, i think its because the import pygame on the main doesnt highlight ,like its not being used but it highlights on the sprites file, idk what to do
Here it is WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pygame/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pygame/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pygame/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pygame/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pygame/ Could not fetch URL pypi.org/simple/pygame/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pygame/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping ERROR: Could not find a version that satisfies the requirement pygame (from versions: none) ERROR: No matching distribution found for pygame WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Could not fetch URL pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
@@ShawCode Nope, it did this the first time I tried to install it. It says it cannot find the SSL Module in python/ there is an issue confirming the ssl certificate since its not there. I don't know what exactly it means haha. But I presume something that required is missing which is the SSL Module in python... But I don't know what an ssl module is lol
I'm not really sure what the issue is, but you could try manually installing pygame with a wheel file. To install wheel files, check this link: stackoverflow.com/questions/27885397/how-do-i-install-a-python-package-with-a-whl-file. The pygame wheel file is here: pypi.org/project/pygame/#files
Hi, great tutorial. Just one question: inside the while loop in g.main(), do self.events(),self.draw() and self.update() run in parallel? If not, how is it able to check for events, draw on the screen and update it all at the same time?
@@ShawCode I’ve been thinking about it and I think it’s that all 3 processes run before the next frame is displayed, and you see the result of all 3 when that frame is displayed, so it’s more like an illusion that they all take place at the same time.
@@MidnightAnimaI remember orders? the computer will read the whole block of code until there's ';' or '}' and generate from what the computer was instructed.
This is very clear and I can follow what's going on even though I'm not good with python or pygame. But, is there a place (website) where the entire code can be seen? I fear that I'll end up with errors/problems when I run the program and won't be able to go back and find where in the tutorial the specific code was presented to see what I mistyped.
I’m getting the error: File “main.py”, line 56, in g.intro_screen() AttributeError: ‘Game’ object has no attribute ‘intro_screen’. Even though intro_screen is clearly defined as a function.
How ever young this fella is, really makes me regret wasting DECADES just playing games and wasting around, instead of asking myself "hmm, how to actually MAKE that myself?!"
Woah woah woah bro I have been offline for a month and now u ARE MAKING RPG VIDEOS , DAMN RIGHT AM RIGHT WITH YOU BRO ,just have to take care of kivy and oop tutorials on your channel first
I have a problem. not sure if this is just because im using a different editor or something, but: Traceback (most recent call last): File "main.py", line 60, in g.new() File "main.py", line 24, in new self.player = Player(self, 1, 2) File "sprites.py", line 10, in __init__ self.layer = PLAYER_LAYER File "AppData\Roaming\Python\Python311\site-packages\pygame\sprite.py", line 238, in layer if not self.alive(): File "AppData\Roaming\Python\Python311\site-packages\pygame\sprite.py", line 215, in alive return bool(self.__g) AttributeError: 'Player' object has no attribute '_Sprite__g' Did i miss something?
Thanks! Once you have understood the content in tutorials, you don't need to memorise - just use documentation for looking up classes and functions, etc.
I like the style of coding you're using. Makes a lot of sense to do it this way! I'm having a problem running the code, however. I feel like I've copied it exactly but I get a 'pygame window not responding' error when running. :^ (
Bro i was making snake game can you please tell me the logic of increasing the length of snake i don't understand it i watch many tuts they all increasing it by making list and i don't understand what eLse they do please tell me the logic and how to make it🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Well, you might have a list of snake body parts. When the head collides with the food, add to the list. Then iterate over that list, and draw a body part for each item in the list.
Bro i inderstand it but please just tell me how can i set the other body parts just after head of snake and make them follow snake please tell me 💓💓💓💓💓💓💓💓💓💓 from india
Hello ShawCode. Really great video. I'm extremely interested in game development and your video is really helpful. I started learning to code back in December 2021.Here's a thought that bothers me...I keep seeing different ways to write something and it messes with me sometimes because I want to learn to write something the cleanest and most efficient way possible if possible. I like your video because it teaches me to use functions and classes more which is what I originally thought was the best way after finishing a python basics tutorial. Do you have any thoughts on how I should write my code? 2, How long have you been coding before you made this video? I like to ask because it gives me a timeline for progression based on how long they've been coding since you seem so comfortable coding and teaching it.
Hello Shaw! Great video and more advanced but cleaner code, perfect for my purposes! Do you have your assets and codes uploaded somewhere? If not I would definitely recommend doing that (if the assets are open source)!
Hi, thanks for the tutorial. I'm getting an error however when I ran it: Traceback (most recent call last): File, line 55, in game = Game() File , line 11, in __init__ self.screen = pygame.display.set_mode((WINW, WINH)) NameError: name 'WINW' is not defined Although I am importing: import pygame, sys from pygame import * from config import * from sprites import * config and sprites are in the same directory as main, so it might be my text editor (I use atom). I've had issues with atom trying to access different files and such, but I dont know how to resolve them. my code is identical to yours, other than that, and i've tripled checked my spelling edit, seems like atom is trying to use an alternate directory. if i fix it, ill take down my comment, but until then, pls help cause im somewhat new to programming
@@ShawCode its no problem Yeah, everything was defined, I ended up copy and pasting everything from the imported files into the main script and everything worked fine. The thing is, when I tried it in atom originally, the files would not import, but when i tried it vscode with no changes to the directory or organizationor anything like that, the files imported but pygame would not
Please could you copy and paste in where you instantiate the Player, as well as the Player class for me to look at? I've got a discord, you can join it!
@@ShawCode File "d:\Sujay\python.rpg\main.py", line 58, in g.new() File "d:\Sujay\python.rpg\main.py", line 23, in new self.player = Player(self, 1, 2) File "d:\Sujay\python.rpg\sprites.py", line 10, in __init__ self.layer = PLAYER_LAYER .py", line 239, in layer File "D:\Users\alokj\AppData\Local\Programs\Python\Python39\lib\site-packages\pygame\sprite.py", line 215, in alive return truth(self.__g) AttributeError: 'Player' object has no attribute '_Sprite__g' PS D:\Sujay\python.rpg> & D:/Users/alokj/AppData/Local/Programs/Python/Python39/python.exe d:/Sujay/python.rpg/config.py PS D:\Sujay\python.rpg> & D:/Users/alokj/AppData/Local/Programs/Python/Python39/python.exe d:/Sujay/python.rpg/main.py pygame 2.0.1 (SDL 2.0.14, Python 3.9.1) Hello from the pygame community. www.pygame.org/contribute.html Traceback (most recent call last): File "d:\Sujay\python.rpg\main.py", line 58, in g.new() File "d:\Sujay\python.rpg\main.py", line 23, in new self.player = Player(self, 1, 2) File "d:\Sujay\python.rpg\sprites.py", line 10, in __init__ self.layer = PLAYER_LAYER File "D:\Users\alokj\AppData\Local\Programs\Python\Python39\lib\site-packages\pygame\sprite.py", line 239, in layer if not self.alive(): File "D:\Users\alokj\AppData\Local\Programs\Python\Python39\lib\site-packages\pygame\sprite.py", line 215, in alive return truth(self.__g) AttributeError: 'Player' object has no attribute '_Sprite__g' PS D:\Sujay\python.rpg>
I learned it from internet tutorials! If you would like to learn, I've got a full python course from beginner to pro. Beginner Tutorials: ua-cam.com/play/PLkkm3wcQHjT7Seo5VeYwEMNP4TEzr5rBu.html Intermediate Tutorials: ua-cam.com/play/PLkkm3wcQHjT6FZegW_PL0lD3UBINcVSrX.html Advanced Tutorials: ua-cam.com/play/PLkkm3wcQHjT5096yBPNoRGpO1dSQN4m85.html
When I try to run the code, it says AttributeError: 'Player' object has no attribute '_Sprite__g' Edit: I fixed that, but when I try to run, it simply wont open
should this exact code work using Visual Studio Code? because I am having an error that says: AttributeError: module 'pygame.display' has no attribute 'set_mode_'. I would love to figure out what I can do to fix this since I dont fully understand everything you did in the tutorial making it hard to debug myself. Thanks for the video though I appreciated it!!!
@@ShawCode thanks for the reply. "Passing that game as an objet" If i understand, you can pass class variables into another class? If it's the case why not use a super class instead? and why you write __init__ at the end, right after that? Thanks Shaw!
At first of all i would like to thank you for this tutorial and secondly i have some questions. I got some errors and i just start to programing with python, i am just a newbie, so i decide to ask hopefully you can help me. Traceback (most recent call last): File "C:\Users\Blank\AppData\Local\Programs\Python\Python39\Main.py", line 60, in g.main() File "C:\Users\Blank\AppData\Local\Programs\Python\Python39\Main.py", line 47, in main self.draw() File "C:\Users\Blank\AppData\Local\Programs\Python\Python39\Main.py", line 38, in draw self.all_sprites.draw(self.screen) File "C:\Users\Blank\AppData\Local\Programs\Python\Python39\lib\site-packages\pygame\sprite.py", line 845, in draw newrect = surface_blit(spr.image, spr.rect) TypeError: invalid destination position for blit I dont now how to fix this. As i said im just a newbie but it seams like something mess up with my pygame version. I hope you can help me XD.
@@ShawCode i checked it out and spr.rect is not a tuple so i made it to a tuple with the value spr.rect = (0, 0) and now i can run this program. Thank you bro you helped me alot
Dude, I tried to write the code several times in the same way that you do it, and it keeps giving me the same error: Traceback (most recent call last): File "C:\Users\Frankie\Desktop\PYGAME\main.py", line 62, in g.main() File "C:\Users\Frankie\Desktop\PYGAME\main.py", line 48, in main self.draw() File "C:\Users\Frankie\Desktop\PYGAME\main.py", line 38, in draw self.screen(BLACK) TypeError: 'pygame.Surface' object is not callable >>> Thanks for your time and dedication bro.
Gonna be 100% honest with you. The way you are programming this game is perfect! Use of classes allows for easy reuse of code. And having a config script keeps the main script clean and organized! I love it! 😍
Thanks :D
Thanks! I just finished this part and I just searched for "How to make a RPG in python" and found you. You have my sub.
Thanks for subscribing!
This series is happening at he right moment. I am just past the basics and needed something fun to do.
Nice, I hope you enjoy the series!
Want to make mobile apps with python? Check out this video --> ua-cam.com/video/7oMNqAE_OVE/v-deo.html
I hope you found the first tutorial in this series useful! If you would like to see the next tutorials, then be sure to SUBSCRIBE so you don't miss out! Also, be sure to share this video with anyone who would find it useful!
Hey
@KN HYPER YT Hi!
@@Misty0069 hi
@@goingyoutubers3340 Hi
Hi
Very excited to revisit pygame. We made a game on it in college but I can't remember much. I'm getting into programming again and am thrilled to have come across such a nicely formatted tutorial series. Thanks man!
Thanks, and good luck with learning it again!
15:00 I came over from another video to get a better explanation of that and you did a perfect job.
Glad it helped!
I’m a few videos in and I realy have to say thank you. Seeing this stuff implemented and you explaining it as you do it, is fway more useful than any py basics. This is making this stuff click for me like nothing else has. Thank you very much.
Glad you're finding it useful, thanks!
I'm using these videos to learn python for a school project, and they are perfect! I only discovered this channel today but I hope you come back! Thank you!!!!!
Your code has a very clear and easy to follow structure to it, compared with other pygame tutorials I've seen.
I am agreed
Hey there! This is one of my most favourite tutorials. You are concise and explain everything in the perfect amount of detail. One tip for you is to use Vscode (visual studio code) since the software automatically tells you if there are any bugs or things missing. Thanks for the tutorial.
This is exactly what I needed. Not saying I'll ever make a game using pygame, but it is good practice to program a game from scratch outside of an IDE/program. Thanks for this tutorial.
Glad it helped!
the most valuable thing in programming i think is:
the yx,or xy loop.
y=0
x=0
end=10
while y != end:
x=0
while x != end:
x=x+1
y=y+1
you can use it for grids,files ,anything that uses columns and rows.
and loop trough them.
ofc in 3d,you also add z.
now its not useful by itself.
but add in string-substitution ,the split(),and strip() methods,+ reading/writhing files, and lists[][].
and you have a whole lot of power in your hands.
i also use os.system("dir /b c:\location > file.txt"), a lot on windows ,to scan directories.
this is a CMD command.
and then use the yx/xy loop to get its contents like so:
file=open("file.txt","r"")
for lines in file.readlines():
lines=lines.strip()
list=lines.split("delimiter")
for word in list:
word=word
file.close()
Wow a new series. The last one I watched was your kivy tutorial and it was amazing
Thanks, hopefully you'll find this one just as good!
You are a blessing...to the world , thank you very much...from South Africa 🇿🇦
Thanks :D
14:57 Timestamp!
Also great tutorial. Love it!
Thanks :D
Dude you really nailed it, this tutorial will help me a lot
Dude - you are awesome! Look forward to watching more of your stuff.
Thanks, I'm working on some new videos at the moment :D
Been waiting for this! Great Vid!
I'm glad you enjoyed it! The next tutorial in the series will be coming next weekend!
Hello, I started to learn python last month and I feel that there is something wrong with my learning ways. Do you have any idea where can I enhance my Fundamental skills and also python skills. I cant think of an amazing and fun projects that can enhance my skills.
I have a Python Basics series that teaches you the fundamentals of python. There are also challenges at the end of each video to test what you have learned: ua-cam.com/play/PLkkm3wcQHjT7Seo5VeYwEMNP4TEzr5rBu.html
This should be ASMR lol, I love the sound of your keyboard!
Lol
I have this problem at the end where line 2: code: from sprites import *: they say the from is the error but its the same as your code. What can I do.
Could you please copy and paste your code for me to look at?
I really admire that not only was the coding detailed and neat, but you explained it clearly and made it easy to understand :D although if you haven't done so already and are ok with me asking, could you possibly do an inventory available to the player once they collect items, as well as features that alter the players strength or stuff like that? For example: +2 luck or +8 crit damage
Thanks! I won't be doing any more Pygame RPG tutorials, but an inventory system would probably just be a list in the Player class, and items are added when they are collided with. The player strength and crit damage would also just be variables in the player class, and the items in the inventory list could alter them.
Hi, i'm trying tô make the character walk but i'm stuck, can you help me? I tried to create a def walk within the Player class and create a event.type within the def events
We will be covering movement in the next video, coming this weekend. You have the right idea for the movement, good job!
@@ShawCode thanks 😁😁😁
i don't know how Player class is used. I know self.all_sprites.draw(self.screen) somehow related to Player class, but i don't get it
Спасибо тебе, мужик. Отличные видео. Всё понятно и структурно описано.
Thanks you , Keep up the Great work
I WANT TO LEARN PYGAME THEN SUDDENLY YOU UPLOAD IT THANKSSS :))
:D
so i copied your code and it won't run, i think its because the import pygame on the main doesnt highlight ,like its not being used but it highlights on the sprites file, idk what to do
Greetings from Greece, nice video, keep it up!
Thanks!
hello , it says that modulenotfound for sprites
how do i fix it?
How does self.all_sprites.draw(self.screen) works?
Thanks bro
Just i have a probleme when i run the code
Pygame start buggind and doesnt answer
What errors do you get?
Question? When installing pygame through pip, I get an error where it says like the SSL module is not available?
Please could you paste in the full output of the command?
Here it is
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pygame/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pygame/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pygame/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pygame/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pygame/
Could not fetch URL pypi.org/simple/pygame/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pygame/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement pygame (from versions: none)
ERROR: No matching distribution found for pygame
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
@@applesauce6644 Did it say that the pygame requirement is already satisfied before the warning? Because that means that it is already installed.
@@ShawCode Nope, it did this the first time I tried to install it. It says it cannot find the SSL Module in python/ there is an issue confirming the ssl certificate since its not there.
I don't know what exactly it means haha. But I presume something that required is missing which is the SSL Module in python... But I don't know what an ssl module is lol
I'm not really sure what the issue is, but you could try manually installing pygame with a wheel file. To install wheel files, check this link: stackoverflow.com/questions/27885397/how-do-i-install-a-python-package-with-a-whl-file. The pygame wheel file is here: pypi.org/project/pygame/#files
Quick question not video related but I'm not allowed to speak in your discord is there like rules to agree or something?
Thanks for joining! The server is paused at the moment, I'm just waiting a little while for various reasons before I open it again.
@@ShawCode ok thank you
Hi, great tutorial. Just one question: inside the while loop in g.main(), do self.events(),self.draw() and self.update() run in parallel? If not, how is it able to check for events, draw on the screen and update it all at the same time?
Good question! They aren't in parallel, and I don't honestly know the exact reason why it works. I think it's to do with how Pygame itself works.
@@ShawCode I’ve been thinking about it and I think it’s that all 3 processes run before the next frame is displayed, and you see the result of all 3 when that frame is displayed, so it’s more like an illusion that they all take place at the same time.
@@MidnightAnimaI remember orders? the computer will read the whole block of code until there's ';' or '}' and generate from what the computer was instructed.
This is very clear and I can follow what's going on even though I'm not good with python or pygame. But, is there a place (website) where the entire code can be seen? I fear that I'll end up with errors/problems when I run the program and won't be able to go back and find where in the tutorial the specific code was presented to see what I mistyped.
Hey there great tutorial its perfect but im getting a error saying player has no atribute for 'self' and g.new apparent has a error
while g.running():
TypeError: 'bool' object is not callable
Could you please copy and paste your code for me to look at?
You seem very good at teaching this.
Thanks :D
SHARTICUS says: thanks for the tutorial!
You're welcome!
I’m getting the error:
File “main.py”, line 56, in
g.intro_screen()
AttributeError: ‘Game’ object has no attribute ‘intro_screen’.
Even though intro_screen is clearly defined as a function.
Please could you copy and paste your code for me to look at?
Mind if I send a pastebin of it?
Sure!
@@ShawCode update: I finally fixed it
@@Rilshock how
"self.player = Player(self,1,2)" when I write this code ıt says me "NameError: name 'Player' is not defined"
did u ever find out the solution?
Same
How do you make a py file I think I'm lost 😅
Think I messed something up my code won’t run the game guess I’ll have to rewatch
How ever young this fella is, really makes me regret wasting DECADES just playing games and wasting around, instead of asking myself "hmm, how to actually MAKE that myself?!"
This is good tutorial and hello from Russia.
Hi, thanks!
Yo Brilliant Shaw I love it
Thanks!
omg I love it!!!! waiting for part two
Thanks, the next video will be out this weekend!
Can't wait!
Ur tutorials are rlly helping thank u
Glad you like them!
Can you not use hex codes to change the colour? Also where did that "g" class come from?
I'm not sure about hex codes, I've always just used RGB - try it out with hex! The 'g' object is just an instance of the game class.
wow great,don't stoping , from Uzbekistan Khiva
:D
how did you run the game at the end what is the hotkey ?
It depends on what text editor you are using. If you are using Sublime Text, press Ctrl+B.
sorry quick question I'm french and I don't reall y understand what a sprite is can you help me please ?
A sprite is basically just an object in a video game - for example, a character, or an enemy, or a sword or tree.
@@ShawCode ok thank you
amazing bro, love ya dude
Glad you enjoyed it!
@@ShawCode thanks dude
hello i keep getting an error to do with the sprite and the file dir
What error do you get? Sorry for the late reply
Woah woah woah bro I have been offline for a month and now u ARE MAKING RPG VIDEOS , DAMN RIGHT AM RIGHT WITH YOU BRO ,just have to take care of kivy and oop tutorials on your channel first
:D
I have a problem. not sure if this is just because im using a different editor or something, but:
Traceback (most recent call last):
File "main.py", line 60, in
g.new()
File "main.py", line 24, in new
self.player = Player(self, 1, 2)
File "sprites.py", line 10, in __init__
self.layer = PLAYER_LAYER
File "AppData\Roaming\Python\Python311\site-packages\pygame\sprite.py", line 238, in layer
if not self.alive():
File "AppData\Roaming\Python\Python311\site-packages\pygame\sprite.py", line 215, in alive
return bool(self.__g)
AttributeError: 'Player' object has no attribute '_Sprite__g'
Did i miss something?
nevermind, i fixed it.
@@TheGreatGamer64 I'm getting the same errors. How did you fix it?
How did you fix it? Having the same problem
Very nice,i just started learning python and i wanted to ask,how do you know what to do without constantly having to look up tutorials?
Thanks! Once you have understood the content in tutorials, you don't need to memorise - just use documentation for looking up classes and functions, etc.
@@ShawCode interesting..i don't wanna be too dependent on tutorials ...thanks!
Great video, but one issue I get is an attributeError that 'Game' object has no attribute 'playing'. Any way I can resolve this?
Could you please copy and paste your code for me to look at?
Hello, one year later - have you fixed this yet?
Awesome work! Thanks for sharing!
Thanks!
You're awesome
Keep it up!
Thanks!
Thanks bro such a great tutorial.
Glad you liked it!
@@ShawCode ✌
Hello, where is the link to the code for this project?
Didn't saw the video yet but seems awesome
I hope you find it useful!
Thank you man you are a real legend
I like the style of coding you're using. Makes a lot of sense to do it this way!
I'm having a problem running the code, however. I feel like I've copied it exactly but I get a 'pygame window not responding' error when running. :^ (
Thanks! Please could you copy and paste your code if you are still having this issue?
Great tutorial man 🙂
Glad you liked it!
thank you bro.......can i use linux to convert python file in to apk???,,....
linux or ubuntu???please
Sure, check out this video: ua-cam.com/video/yr7n0C2tspI/v-deo.html
pygame window not appearing for me
Helpful video 👍
I'm glad you found it useful!
Bro i was making snake game can you please tell me the logic of increasing the length of snake i don't understand it i watch many tuts they all increasing it by making list and i don't understand what eLse they do please tell me the logic and how to make it🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Well, you might have a list of snake body parts. When the head collides with the food, add to the list. Then iterate over that list, and draw a body part for each item in the list.
Bro i inderstand it but please just tell me how can i set the other body parts just after head of snake and make them follow snake please tell me
💓💓💓💓💓💓💓💓💓💓 from india
You would need to get the coordinate of the last body part in the list and base the new part off of that.
@@ShawCode oh thanks bro that one is last can you tell me how can i do this please tell me with code please
What code have you got so far?
Awesome video bro
Thanks!
Hello ShawCode. Really great video. I'm extremely interested in game development and your video is really helpful. I started learning to code back in December 2021.Here's a thought that bothers me...I keep seeing different ways to write something and it messes with me sometimes because I want to learn to write something the cleanest and most efficient way possible if possible. I like your video because it teaches me to use functions and classes more which is what I originally thought was the best way after finishing a python basics tutorial. Do you have any thoughts on how I should write my code? 2, How long have you been coding before you made this video? I like to ask because it gives me a timeline for progression based on how long they've been coding since you seem so comfortable coding and teaching it.
Hello Shaw!
Great video and more advanced but cleaner code, perfect for my purposes!
Do you have your assets and codes uploaded somewhere?
If not I would definitely recommend doing that (if the assets are open source)!
Hi, you can get the assets from the description of the 4th tutorial. Thanks!
If a rectangle is 32 pixels by 32 pixels, is it a square?
Yes
@@ShawCode lol
@@Mo-xx9gg squares can be rectangles as well.
Hi, thanks for the tutorial. I'm getting an error however when I ran it:
Traceback (most recent call last):
File, line 55, in
game = Game()
File , line 11, in __init__
self.screen = pygame.display.set_mode((WINW, WINH))
NameError: name 'WINW' is not defined
Although I am importing:
import pygame, sys
from pygame import *
from config import *
from sprites import *
config and sprites are in the same directory as main, so it might be my text editor (I use atom). I've had issues with atom trying to access different files and such, but I dont know how to resolve them. my code is identical to yours, other than that, and i've tripled checked my spelling
edit, seems like atom is trying to use an alternate directory. if i fix it, ill take down my comment, but until then, pls help cause im somewhat new to programming
Is WINW and WINH defined in config.py? Sorry for the late reply
@@ShawCode its no problem
Yeah, everything was defined, I ended up copy and pasting everything from the imported files into the main script and everything worked fine. The thing is, when I tried it in atom originally, the files would not import, but when i tried it vscode with no changes to the directory or organizationor anything like that, the files imported but pygame would not
when i try to install pygame it doesn't install what should i do
When you try to install it, what happens?
it says: pip is not recognized as an internal or external command.
Watch this video: ua-cam.com/video/D9jct9L9Lcs/v-deo.html
thank you
Kid ! You're awesome.
Thank you very much for this video
I'm glad you found it useful!
Any tips on learning proficiently? Just follow tutorials?
You should follow tutorials to help you understand a tool/language/library, but once you have learnt it, you should go and make your own projects.
MY G, it is showing an error AttributeError: 'Player' object has no attribute '_Sprite__g' , Also do you need a discord I can make you one!
Please could you copy and paste in where you instantiate the Player, as well as the Player class for me to look at? I've got a discord, you can join it!
@@ShawCode File "d:\Sujay\python.rpg\main.py", line 58, in
g.new()
File "d:\Sujay\python.rpg\main.py", line 23, in new
self.player = Player(self, 1, 2)
File "d:\Sujay\python.rpg\sprites.py", line 10, in __init__
self.layer = PLAYER_LAYER
.py", line 239, in layer
File "D:\Users\alokj\AppData\Local\Programs\Python\Python39\lib\site-packages\pygame\sprite.py", line 215, in alive
return truth(self.__g)
AttributeError: 'Player' object has no attribute '_Sprite__g'
PS D:\Sujay\python.rpg> & D:/Users/alokj/AppData/Local/Programs/Python/Python39/python.exe d:/Sujay/python.rpg/config.py
PS D:\Sujay\python.rpg> & D:/Users/alokj/AppData/Local/Programs/Python/Python39/python.exe d:/Sujay/python.rpg/main.py
pygame 2.0.1 (SDL 2.0.14, Python 3.9.1)
Hello from the pygame community. www.pygame.org/contribute.html
Traceback (most recent call last):
File "d:\Sujay\python.rpg\main.py", line 58, in
g.new()
File "d:\Sujay\python.rpg\main.py", line 23, in new
self.player = Player(self, 1, 2)
File "d:\Sujay\python.rpg\sprites.py", line 10, in __init__
self.layer = PLAYER_LAYER
File "D:\Users\alokj\AppData\Local\Programs\Python\Python39\lib\site-packages\pygame\sprite.py", line 239, in layer
if not self.alive():
File "D:\Users\alokj\AppData\Local\Programs\Python\Python39\lib\site-packages\pygame\sprite.py", line 215, in alive
return truth(self.__g)
AttributeError: 'Player' object has no attribute '_Sprite__g'
PS D:\Sujay\python.rpg>
Thanks. Please could you also paste in your player class? I think your error will be coming from a typo in there.
@@ShawCode class Player(pygame.sprite.Sprite):
def __init__(self, game, x, y):
@@brok3n_bot Thanks - could you also paste in the rest of the class? I should have been more specific with what I wanted to see lol.
Thank you! For the great video į just have One error it says: line 59, in
while g.running:
AttributeError: 'Game' object has no attribute 'running'
Update: fixed
@@karolispaulauskas7594 how please
I don't really know because my Brother helped me with the error.
Do you know which part you changed? I also have this error
@@simgames9133 have you fixed it yet?
very nice, but File "c:\Users\autos\Desktop\vpython\main.py", line 53, in
g = Game() why?/???/??/???????
How did u learn python
I learned it from internet tutorials! If you would like to learn, I've got a full python course from beginner to pro.
Beginner Tutorials: ua-cam.com/play/PLkkm3wcQHjT7Seo5VeYwEMNP4TEzr5rBu.html
Intermediate Tutorials: ua-cam.com/play/PLkkm3wcQHjT6FZegW_PL0lD3UBINcVSrX.html
Advanced Tutorials: ua-cam.com/play/PLkkm3wcQHjT5096yBPNoRGpO1dSQN4m85.html
shaw how many programming languages do you khow
I know Python the best, but I also know Java, Javascript, as well as a little bit of C++
@@ShawCode well shaw thanks from Tajikistan for the cute and nice video
:D
love the content. can you give me advice to succeed in programming plz i'm a beginner
Thanks! Just make sure you understand the concepts of programming, and then start working on some projects!
When I try to run the code, it says AttributeError: 'Player' object has no attribute '_Sprite__g'
Edit: I fixed that, but when I try to run, it simply wont open
how did you fix this?
Hi, how did you manage to fix it?
Nice tutorial.
Thanks!
Can you do a tutorial on how to make a 3d open world game, like an mmo?
That might be a little too ambitious for Python - you would need to use C++ or C# to make a game like that!
@@ShawCode Was afraid of that. I have those languages on my list, but I'm still learning python rn.
Nice - Good look with learning them!
@@ShawCode Thanks! I'll need it!
Great
Love for you ❤️
:D
should this exact code work using Visual Studio Code? because I am having an error that says: AttributeError: module 'pygame.display' has no attribute 'set_mode_'.
I would love to figure out what I can do to fix this since I dont fully understand everything you did in the tutorial making it hard to debug myself.
Thanks for the video though I appreciated it!!!
Please could you copy and paste your code? If there is anything you don't understand, let me know :D
Mine is telling me: 'int' object is not callable
@@TLM-Nathan remove the () after the said object
8:52 , i'v watched the next 30sec at least 100 times, seems like i don't understand classes anymore.
What don't you understand?
@@ShawCode thanks for the reply. "Passing that game as an objet"
If i understand, you can pass class variables into another class? If it's the case why not use a super class instead?
and
why you write __init__ at the end, right after that?
Thanks Shaw!
love you so much bro thank a lot
No problem :D
@@ShawCode waiting for next ep of your pyopengl series
nice tutorial
Thanks!
@@ShawCode your welcome
Very beautiful♡
I'm glad you found it useful!
good job I suggest you add a following algorithm. (only if you think its better)
Thanks for the idea, I might add it in!
Hey bro, really good tutorial. Would be good if you have any link to the source code. Nice tut btw
Thanks! I will be releasing the source code on GitHub once I have finished the series.
@@ShawCode Ok, that's nice. :)
Thank you
:)
At first of all i would like to thank you for this tutorial and secondly i have some questions.
I got some errors and i just start to programing with python, i am just a newbie, so i decide to ask hopefully you can help me.
Traceback (most recent call last):
File "C:\Users\Blank\AppData\Local\Programs\Python\Python39\Main.py", line 60, in
g.main()
File "C:\Users\Blank\AppData\Local\Programs\Python\Python39\Main.py", line 47, in main
self.draw()
File "C:\Users\Blank\AppData\Local\Programs\Python\Python39\Main.py", line 38, in draw
self.all_sprites.draw(self.screen)
File "C:\Users\Blank\AppData\Local\Programs\Python\Python39\lib\site-packages\pygame\sprite.py", line 845, in draw
newrect = surface_blit(spr.image, spr.rect)
TypeError: invalid destination position for blit
I dont now how to fix this.
As i said im just a newbie but it seams like something mess up with my pygame version.
I hope you can help me XD.
What is spr.rect? It has to be a tuple, for example: (100, 100)
@@ShawCode i checked it out and spr.rect is not a tuple so i made it to a tuple with the value
spr.rect = (0, 0)
and now i can run this program.
Thank you bro you helped me alot
Dude, I tried to write the code several times in the same way that you do it, and it keeps giving me the same error:
Traceback (most recent call last):
File "C:\Users\Frankie\Desktop\PYGAME\main.py", line 62, in
g.main()
File "C:\Users\Frankie\Desktop\PYGAME\main.py", line 48, in main
self.draw()
File "C:\Users\Frankie\Desktop\PYGAME\main.py", line 38, in draw
self.screen(BLACK)
TypeError: 'pygame.Surface' object is not callable
>>>
Thanks for your time and dedication bro.
It should be self.screen.fill(BLACK) rather than self.screen(BLACK)