The thing is, theres no point in watching tutorials when you have the fundamentals down. Doing so only makes you overly dependant on them and unable to do any real project by yourself without copying code from the same source you used to make the tutorial's game. Ive been through this, and trust me, i definetly recommend you dont watch tutorials for full games, even for tutorials like these whats important is to take away the idea of how someone else goes about doing it, but you cant really just do it the exact same way. A program is essentially the visual form of someones logic. You cant think the same way as somebody, so it makes sense that when your making a full game, you only use the same *ideas*, but not the same logic. For example putting your particles in a list with list comprehension or the idea of making the tilemap as a matrix. But when your implementing those, they need to be from solid effort, reading docs and articles Otherwise, your really never gonna be able to make your own game :)
I thought this vid was fantastic. I'm trying to get into the whole programming language thing almost from scratch. I've done a couple of really good python tutorials on line so I can get the gist of what's going on here. But this is many levels on from my current ability and it is truly inspiring and exciting to watch. An amazing vid in my opinion. Thank you so much for posting.
The movement in that animation is done by having a target and moving x% towards the target every frame so it slows down as it gets closer. The card menu works similarly.
I recommend checking out State Design Pattern or more broadly Finite State Machines in the context of game development to solve this exact problem, after you understand what the author of the video is proposing
@@DaFluffyPotato that would be awesome! i was thinking same but ignore how to increase or decrease the opacity of an object over time, thanks for your answer :)
Where can i see the code for the menu screen shown for drawn down abyss? I wonder if the Draw_text function contain the code for creating the buttons around the text and centering it perfectly 😅
quick question: if I implement a pause menu, like this one, when I resume the game I guess the game loop gets re-initialised, so the game starts again from the beginning. Is there a way to avoid that? I was thinking maybe you have to somehow save the game state somewhere and when 'resume' is clicked you load the game from that position
I am also learning Pygame. I just took another tut, and used this: pygame.time.delay(5000) It delays the game (the clock?) for 5 seconds, then resumes the game. So you might need to use a flag(?) that will tell the function when the resume button is pressed. pygame.time.delay(ResumeButtonReleased)
I think calling font.render every frame is a bad idea. Also i dont like pygame's bad font rendering. But what you are doing with that library is awesome!
I was testing and running before the whole thing finished and I was getting weird errors about syntax for "button_2 = pygame etc... More specifically the "b" in button was highlighted, but it had no problem with button_1 = py..etc I checked all my other syntax and I couldn't find a reason but I copied the pastebin and it was the exact same, no issues! lol. Thanks! This helped me grasp the refreshing of the screens while switching functions/menus/screens.
Hello ! First, thanks for your video ! your explanations are very cool. I have an issue with mine, I have two methods, the first one makes you go to the second by a click (exactly like your tutorial) but, in the second one, i have 3 buttons , but they don't work, the error is : UnboundLocalError: local variable 'click' referenced before assignment I believed this was due to the fact that I allready used "click" in the first method, but no, if i change the name, this still not working, any idea ?
When i click to open the game. it just flicks the game() like it opens game() , but automatically runs main_menu() since its there at the bottom, i guess... how to do it.... ? i think i done everything the way u showed.... def main menu ( choose game() ) , then def game then main_menu() at the end. ...
Thanks, just what i was looking for. But was woundering wouldt it be smarter making a class instead of copying det functions everytime. Just to make it look a bit cleaner
@@DaFluffyPotato i also have another question. im trying to text on the button but i dont know how to do it. (i have also seen the comment that asks this aswell but i dont understand how to do it)
@@Steppy Pygame doesn't have built in functionality for "buttons". You make them yourself out of images, text, and input. (Show text on top of an image, check for clicks, then check if the click is on the button.)
hi, I know there are a hundred of comments here and you probably get dozens a day, but I followed your advice on this and really wanted to know, do you know a way of displaying a variable such as coins or gold on the menu, while that variable is defined and changed in one of the game loops. Id be really thankful for any help you could give me.
Hello, I am studying pygame recently. I come from China. There are few domestic materials. Most of them are talking about the APIs given by pygame. A few very simple cases. I still don't know what to do next. It feels like there is no game programming thought. When I want to see some other people's game cases on the official website, I don't understand what others have written. Most of them have no comments. what should I do?
I learned by messing around with people’s code to see what happened. This can still be done without comments. If you know the basics, I’d recommend just making simple stuff and trying to figure out the complex stuff. A lot of stuff isn’t actually Pygame specific. The concepts apply to just about any graphics library.
Damn if only i learned this months ago before i added SOOO MUCH MENUS to my game -.- Refactoring will take awhile but definitely will need to be done aince this causes less bugs
@@DaFluffyPotato and how to adapt to different screen resolutions? I just have a problem. I am making a game with a resolution of full hd and the monitors with a lower resolution have buttons moving
You legend. Giving each screen its own game loop is such a good idea.
I was wondering how I can encapsulate each screen and it's contents but never thought of separate game loops. What a legend
In hindsight (and having implementing the idea) I retract this comment. Each loop requires the same boilerplate setup (clock, event handling, etc).
@@RobinNeville What do you recommend then?
@@nicolaiv.9757 using a gamestate stack
@@dylanboyd6147 how would you go about doing that?
Actually figured this out on my own surprisingly. Saw this vid and wanted to compare our code, turns out its pretty similar! Thanks for the videos!
it's more that people coming to these tutorials are new to coding (like me lmao) so it feels very smart and impressive
yes YES this is what i was thinking and this video immediately popped up youtube algorithm is good
would love to see a full series on how to make RPG game. Like basic mechanics, systems.
Yeah I also requested hi several times may be he is gonna do so in 2021 who knows?
Ye that would be great
The thing is, theres no point in watching tutorials when you have the fundamentals down. Doing so only makes you overly dependant on them and unable to do any real project by yourself without copying code from the same source you used to make the tutorial's game.
Ive been through this, and trust me, i definetly recommend you dont watch tutorials for full games, even for tutorials like these whats important is to take away the idea of how someone else goes about doing it, but you cant really just do it the exact same way.
A program is essentially the visual form of someones logic. You cant think the same way as somebody, so it makes sense that when your making a full game, you only use the same *ideas*, but not the same logic.
For example putting your particles in a list with list comprehension or the idea of making the tilemap as a matrix. But when your implementing those, they need to be from solid effort, reading docs and articles
Otherwise, your really never gonna be able to make your own game :)
@@soupnoodles facts 👍👌
I would say learning C++ would be the best for learning an RPG...
dude this is genius. i have been bashing my head over this stupid problem for so long.
I have never used the commend section before, but today I got so much core input in 3 min... nice video and thank you
I thought this vid was fantastic. I'm trying to get into the whole programming language thing almost from scratch. I've done a couple of really good python tutorials on line so I can get the gist of what's going on here. But this is many levels on from my current ability and it is truly inspiring and exciting to watch.
An amazing vid in my opinion. Thank you so much for posting.
You are a real benediction for us the beginners ! Thanks a lot !
How do you code the menus such that you maneuver through them with arrow keys rather than clicking the buttons with your mouse?
Watched tons of videos an didn't quite understand until watching your video! Great work!
Hey how can i add text on button for this code
Hey, Want to know how did add that animation at 6:02.
And could you also make a video on how to implement the card video that you have shown at 6:42
The movement in that animation is done by having a target and moving x% towards the target every frame so it slows down as it gets closer. The card menu works similarly.
@@dafluffypotatovr7362 Thanks for reply
And how to add a target... Please make a video on card menu tutorial for beginner
I recommend checking out State Design Pattern or more broadly Finite State Machines in the context of game development to solve this exact problem, after you understand what the author of the video is proposing
Hello very important question, I have a project due and I'd like to know how to add text to these button?
This is a fantastic tutorial - very easy to follow and understand. Thank you!
at 6:18 there is a button to go fullscreen, what is the code to make your Pygame window fullscreen?
Use the pygame.FULLSCREEN flag when you use .set_mode
some bug that occurs in linux, the options don't work and the button doesn't appear and the escape also doesn't work
Thank you for this, wishing you best of luck
Pls You can teach how to make a resolution selector and that absolutely everything adapts to the new resolution
You are amazing. ❤ Even Chat gpt doesn't make it this simple
how would you implement this same main menu like code for an in-game pause menu?
How do you implement the transitions between windows such as 6:10 ? Thanks in advance :)
Just blit a black surface over everything at an increasing opacity. (and do the reverse afterwards) I'll probably make a video on it.
@@DaFluffyPotato that would be awesome! i was thinking same but ignore how to increase or decrease the opacity of an object over time, thanks for your answer :)
Where can i see the code for the menu screen shown for drawn down abyss?
I wonder if the Draw_text function contain the code for creating the buttons around the text and centering it perfectly 😅
This is the part where you clutch that sweet-sweet inheritance quirk
I wish I could like this video twice.
I liked the card menu most...!!
May you explain please, how it is created in pygame ?
If it was created with Python, then it should be the same as PyGame (I haven't watched the video so I don't know whether it's in Python or not)
@@JBP.Shr3k what
Hi, iv copied the code but I keep getting an invalid syntax on the mx .. does anyone know how to fix that?
This helped me so much, thanks man.
How can i do this with classes, i have 2 games in its own classes, and a main loop. ,
quick question: if I implement a pause menu, like this one, when I resume the game I guess the game loop gets re-initialised, so the game starts again from the beginning. Is there a way to avoid that?
I was thinking maybe you have to somehow save the game state somewhere and when 'resume' is clicked you load the game from that position
I am also learning Pygame.
I just took another tut, and used this:
pygame.time.delay(5000)
It delays the game (the clock?) for 5 seconds, then resumes the game.
So you might need to use a flag(?) that will tell the function when the resume button is pressed.
pygame.time.delay(ResumeButtonReleased)
I somehow understand this now, so thanks a lot!
Great video that explains using different screens perfectly!
Would it be better to use state machine to make the menus?
wow men! thanks a lot, very nice tutorial and very nice menus! :O
Hello I have copied the code and changed some colours and sizes, but I don't know how to put a text in the buttons, can someone tell me how to do it ?
Question...how do you make the code play a pre-made game when you press a button? I've been trying to figure that out for a while?
paste the code into the loop is faster
Very well made video!
Hi, how do you put a text inside the rectangle ? I don't quite understand it
When you draw the red rectangle, you just blit text after drawing the red rectangle
In game menu like an inventory! Would you just blit a screen on an if statement? I get it to appear but disappears quickly after! (In game loop)
You just keep blitting it so it stays
Thanks! I’ll try!
I think calling font.render every frame is a bad idea. Also i dont like pygame's bad font rendering. But what you are doing with that library is awesome!
Can these codes be used in godot?
Need more of this! If you could and have the time I’d like to see how you make a fully developed menu.
HAPPY BIRTHDAY !
Impressive work.
genuinely awesome !
thank you for making it simple
I was testing and running before the whole thing finished and I was getting weird errors about syntax for "button_2 = pygame etc...
More specifically the "b" in button was highlighted, but it had no problem with button_1 = py..etc
I checked all my other syntax and I couldn't find a reason but I copied the pastebin and it was the exact same, no issues! lol. Thanks! This helped me grasp the refreshing of the screens while switching functions/menus/screens.
Nice Video!
A great explanation, easy and with no missunderstandings, such video I looked for.
thanks man!
this code helped us so much!! Thank you
Hello ! First, thanks for your video ! your explanations are very cool.
I have an issue with mine, I have two methods, the first one makes you go to the second by a click (exactly like your tutorial) but, in the second one, i have 3 buttons , but they don't work, the error is :
UnboundLocalError: local variable 'click' referenced before assignment
I believed this was due to the fact that I allready used "click" in the first method, but no, if i change the name, this still not working, any idea ?
Python variables are local by default. Pass the click variable to the function giving you the error.
@@DaFluffyPotato oh ok thank you !
Hey, I am having the exact same problem and i have no idea how to fix it and it only happens randomly as well , can you please help me
@@darien9834 Hey, could you send me your functions, I'll check that
@@khalvissi9303 i messed around for a bit and it just stopped happening now but thanks for the reply
is there a command for start like for exit its exit
how do u add images?
When i click to open the game. it just flicks the game()
like it opens game() , but automatically runs main_menu()
since its there at the bottom, i guess...
how to do it.... ? i think i done everything the way u showed....
def main menu ( choose game() )
, then def game
then main_menu() at the end. ...
I don’t remember what I did in this video very well, but if your results don’t match mine, try the code in the description.
Thanks, just what i was looking for. But was woundering wouldt it be smarter making a class instead of copying det functions everytime. Just to make it look a bit cleaner
And how to do it in Pygame Zero ?
how did you animate them?
hello, how did you put the background image on the menu?
You can put something in the back by rendering everything on top
@@DaFluffyPotato ok ok
@@DaFluffyPotato How to put a button so that when I press on options I can go back to the menu?
Won't there be any issues by recurrently calling one function inside another? What if the player goes from the game to the main menu repeatedly?
You return from the game instead of calling the menu again so that it just goes back up to the menu.
No questions, just want to say I enjoyed the info and examples man. Thanks from someone using pygame and eyetracking for his thesis
Thanks, great explanation
Thanks a lot. Very helpful!
how do i make it so when i click on the game button it switches to the actual game?
if click and mouse_r.colliderect(button_r):
run_game()
@@DaFluffyPotato thanks! but i also found another way
def game():
running = True
while running:
screen.fill((0,0,0))
draw_text('Game', font, (255, 255, 255), screen, 20, 20)
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYDOWN:
if event.key == K_ESCAPE:
running = False
pygame.display.update(main())
mainClock.tick(60)
i added (main()) to the display update at the bottom
@@DaFluffyPotato i also have another question. im trying to text on the button but i dont know how to do it. (i have also seen the comment that asks this aswell but i dont understand how to do it)
@@Steppy Pygame doesn't have built in functionality for "buttons". You make them yourself out of images, text, and input. (Show text on top of an image, check for clicks, then check if the click is on the button.)
hi, I know there are a hundred of comments here and you probably get dozens a day, but I followed your advice on this and really wanted to know, do you know a way of displaying a variable such as coins or gold on the menu, while that variable is defined and changed in one of the game loops. Id be really thankful for any help you could give me.
Hello, I am studying pygame recently. I come from China. There are few domestic materials. Most of them are talking about the APIs given by pygame. A few very simple cases. I still don't know what to do next. It feels like there is no game programming thought. When I want to see some other people's game cases on the official website, I don't understand what others have written. Most of them have no comments. what should I do?
I learned by messing around with people’s code to see what happened. This can still be done without comments. If you know the basics, I’d recommend just making simple stuff and trying to figure out the complex stuff. A lot of stuff isn’t actually Pygame specific. The concepts apply to just about any graphics library.
Damn if only i learned this months ago before i added SOOO MUCH MENUS to my game -.-
Refactoring will take awhile but definitely will need to be done aince this causes less bugs
how did you make the rounded buttons?
Those are images.
@@DaFluffyPotato can you tell me how you did it please?
@@DaFluffyPotato and how to adapt to different screen resolutions? I just have a problem. I am making a game with a resolution of full hd and the monitors with a lower resolution have buttons moving
I didn't find any good tutorial on round buttons in pygame so in my game I applied pygame rectangular shapes with border radius property.... Simple !
@@DaFluffyPotato plz explain how to create clickable image buttons!!
hi, can anyone tell me what does DaFluffyPotato game dev use for making the menu?
He used python and imported pygame to make it... He didn't use a game dev.!! You can make this with any IDE for python!! Best of luck!
I mean I used pygame and python in pycharm and didn't work
@@coconaatti2878 You need to install pygame and then import it... Search for it on youtube..."How to install pygame and use it?"
Oh ok thanks so much 😊
@@coconaatti2878 Np
Thanks man you helped me alot
thanks a lot dude, you're awesome
Hi, you work as what?
THANK YOU SO MUICH DUDE
How can't understand your map source code
Please explain how to design a map
Please please please 🙏😢🙏😥
he have a video in his pygame beginner series
Nice ;D
Thank you so much
Finally found your channel). Really impessed with amount of work, good job, keep it going!
P.S. Hello from Ukraine)
Hey, Can you make a levels tutorial?
That should be covered between the video where I implemented levels loaded from files and this video.
Nice.
Thank you!
I guess .collide_point() is a thing lol
Yeah, I didn't find out until last year for some reason.
THANKSSSS!!
Ooooooppppp
your voice feels like a mixer-grinder
but the stack tho...
3:14
You speak like a drunk (do not offend bro i am your biggest fan)
help my boy lubina he have 2 hours or dead
yes he is
just let me steal the code... im too tired for this rn
noob
Thank you!