man I have rewatched this video so many times this weekend, you made me change my whole code this video literally took me out of tutorial hell, 100% recommended I never understood inheritance and how to pass a whole game object into another engine object until now... you made me convert all of my noob code into very concise functions... this is one of the best tutorials and channels I've found so far about pygame, thanks! please keep the videos coming you're an amazing teacher!
OMG I am currently participating in a game jam and your tutorials are SO USEFUL !!! thank you so much for doing them ! you deserve so much more views !
This is fantastic!!! I wish you would make a series around this simple concept. Like two small tile maps (or images) that you toggle between when you reach an edge (is that a new state? ). Or using text with a changing menu box size. Ex. If you expand magic maybe you’ve earned fire so one size box and later get healing. How do you automatically change the menu size instead of manually coding a different box. Or making a long string of text auto return inside a standard box for dialogue. I think your videos are best because it feels like you are setting us up to make large polished complicated games.
Excellent tutorial! I've been looking into game screens using state pattern and this is really helpful. The only thing I missed was a state diagram showing the state and their transitions, without it it's too magical (too much on-the-mind vs on-the-world knowledge) to know where to put the key handlers + enter_state calls.
Thanks a lot for this! I 've been learning to program with pygame and its been hard. Your explanations are good and i just changed it a little to fit my first project. I also run self.state_stack[-1].events() in main loop events so i can control diferent set of keys :)
This really brings some structure into my game loop. But I still have 3 questions: 1. What do we use the game.state_stack variable for? I understand that it represents the state stack, but why do we need it when all the state instances are chained together? 2. Why do we check if the state stack's length is > 1 before we add the entering state on top? Wouldn't that mean that if its length is exactly 1, nothing would ever be added? 3. Game.update() only says "pass" - how is control transferred to the various states?
usually checking list lengths prevents an indexing error, for example, if you wanted to index a list length 0 you'd get an error, so you first verify that the list is populated. In this example, i think it assumes that the base state is always populated and when you call for the index [-1] you'd get an error if the last index is also the first, therefore the list would have to be at least 2.
What is 'states.state'. It doesnt seem to be working for me. saying something like ' from states.Title import Title ModuleNotFoundError: No module named 'states.Title'; 'states' is not a package'
hey, he called states.state because he had a directory called states. if you dont have write only 'from title import Title', but dont write 'states.' something Hope you understand
Thanks! All of the states inherit from the State class in state.py, so title.py (along with all the other state files) need to import it so that it can be used. Hope that helps!
I was pausing and typing in your code along with the video. I'm using Sublime, so I'm running the game from the terminal. I kept getting a black screen, so I started searching for errors. I gave up and just copy and pasted all your code. I'm still just getting a blank pygame window when I run it. Any suggestions?
Hey Christian, thank you for all that videos, they was very helpful for me. I'm creating the Plants vs Zombies in Pygame. It's almost done, but I need to implement a leaderboard function in this project, using SQLite (DataBase). Can you have any idea to how can I create this ? Thanks for the help!!
Honestly one of the worst tutorials for someone who has already been building a game for a while, hard to implement and pair up variables from your specific use case, to mine.
That’s probably because this video wasn’t intended for someone who has been working on a game for a while. Cdcodes is teaching others how to structure a new game. No need to be rude! I’m sure you’ll find your solution somewhere :)
man I have rewatched this video so many times this weekend, you made me change my whole code
this video literally took me out of tutorial hell, 100% recommended
I never understood inheritance and how to pass a whole game object into another engine object until now... you made me convert all of my noob code into very concise functions...
this is one of the best tutorials and channels I've found so far about pygame, thanks! please keep the videos coming you're an amazing teacher!
Love to hear that this video was able to help! Cheers : )
OMG I am currently participating in a game jam and your tutorials are SO USEFUL !!! thank you so much for doing them ! you deserve so much more views !
Terrific video on an important topic. Very helpful.
Really helpful thank you. Hope to see more soon
Happy to help! Working on a new video, will hopefully be out soon.
love your content! thanks a bunch.
Appreciate it : )
Very thx you for your tutorials.
Very clean/clear. I appreciate to observe your organisation/structuration of your code too.
Thx a lot !!
This is fantastic!!! I wish you would make a series around this simple concept. Like two small tile maps (or images) that you toggle between when you reach an edge (is that a new state? ). Or using text with a changing menu box size. Ex. If you expand magic maybe you’ve earned fire so one size box and later get healing. How do you automatically change the menu size instead of manually coding a different box. Or making a long string of text auto return inside a standard box for dialogue.
I think your videos are best because it feels like you are setting us up to make large polished complicated games.
Thank you very much, bro!
Excellent and clearly understandable example
Happy to help!
Your tutorials are the best I’ve seen!!
Thank you!
Excellent tutorial! I've been looking into game screens using state pattern and this is really helpful.
The only thing I missed was a state diagram showing the state and their transitions, without it it's too magical (too much on-the-mind vs on-the-world knowledge) to know where to put the key handlers + enter_state calls.
Good point, that would have been nice to include in the video. One of these days I can try to make one and leave it in the description
Awesome info! Thank you so much :)
Epic
I have no idea about anything you said in this video.
Thank you! What an amazing tutorial.
I love your tutorials , they are very clear and helpful for newbies, could you make a inventory system tutorial in pygame ? Thanks
Thank you! And yeah I can keep that in mind for future videos!
thank you so much for this video! you are the best!!
Glad you enjoyed, thanks for watching!
Thanks a lot for this! I 've been learning to program with pygame and its been hard. Your explanations are good and i just changed it a little to fit my first project.
I also run self.state_stack[-1].events() in main loop events so i can control diferent set of keys :)
Why does it have so few views?? I think everyone should learn from this video
I love the words " hi there " so much 🤣🤣🤣 it's so cute
underrated.
What a great video!
Thank you!
I did this and now idk how to continue, are any videos continuing parts of this one?
I was finding this type of vidoe only
This really brings some structure into my game loop. But I still have 3 questions:
1. What do we use the game.state_stack variable for? I understand that it represents the state stack, but why do we need it when all the state instances are chained together?
2. Why do we check if the state stack's length is > 1 before we add the entering state on top? Wouldn't that mean that if its length is exactly 1, nothing would ever be added?
3. Game.update() only says "pass" - how is control transferred to the various states?
usually checking list lengths prevents an indexing error, for example, if you wanted to index a list length 0 you'd get an error, so you first verify that the list is populated. In this example, i think it assumes that the base state is always populated and when you call for the index [-1] you'd get an error if the last index is also the first, therefore the list would have to be at least 2.
Great tutorial and explanation! I have a quick question: using this OOP template, how would one add text to menus?
Great tutorial! Do you have any idea how to add a txt map to the game world?
What is 'states.state'. It doesnt seem to be working for me. saying something like
' from states.Title import Title
ModuleNotFoundError: No module named 'states.Title'; 'states' is not a package'
hey, he called states.state because he had a directory called states. if you dont have write only 'from title import Title', but dont write 'states.' something
Hope you understand
I watched your video on how to create a tilemap but how would i implement it into something like this
Thanks for this. Can I ask, how to apply collision for the player?
Here's a really good article on the subject. It has some pseudocode you can use: jonathanwhiting.com/tutorial/collision/
WOAH!
Hey friend, how do I create usable items, like potions, in PyGame?
Awesome video! Question though, you wrote from states.state import State in the title.py module because it refers to the top level script?
Thanks! All of the states inherit from the State class in state.py, so title.py (along with all the other state files) need to import it so that it can be used. Hope that helps!
it doesn't work can u help me ? i want to change the player where can I found it ? and I want to add more menu
I was pausing and typing in your code along with the video. I'm using Sublime, so I'm running the game from the terminal. I kept getting a black screen, so I started searching for errors. I gave up and just copy and pasted all your code. I'm still just getting a blank pygame window when I run it. Any suggestions?
Are you getting the pygame window to at least show up or is the screen just completely blank?
@@CDcodes the pygame window is showing up!
Gotcha. Did you make sure to get the states and assets folders as well?
@@CDcodes I did! :'(
Strange. Head over to my discord and maybe me or someone else can help you out with a bit more context
Hey Christian, thank you for all that videos, they was very helpful for me.
I'm creating the Plants vs Zombies in Pygame. It's almost done, but I need to implement a leaderboard function in this project, using SQLite (DataBase).
Can you have any idea to how can I create this ?
Thanks for the help!!
Hi! I don't have too much experience other than some MySQL, but Corey Shafer has some great videos on the subject. Check him out!
please make a video on how to create mario game with pygame . Pleaseee, i need you help
Here's a popular Github repository for a Mario clone made in Pygame: github.com/mx0c/super-mario-python
Thank you so much
Honestly one of the worst tutorials for someone who has already been building a game for a while, hard to implement and pair up variables from your specific use case, to mine.
That’s probably because this video wasn’t intended for someone who has been working on a game for a while. Cdcodes is teaching others how to structure a new game. No need to be rude! I’m sure you’ll find your solution somewhere :)