Menus - Pygame Tutorial

  Рет қаралды 175,903

DaFluffyPotato

DaFluffyPotato

Күн бұрын

Пікірлер: 162
@Simon-ik1kb
@Simon-ik1kb 4 жыл бұрын
would love to see a full series on how to make RPG game. Like basic mechanics, systems.
@disdis6127
@disdis6127 3 жыл бұрын
Yeah I also requested hi several times may be he is gonna do so in 2021 who knows?
@berightback854
@berightback854 3 жыл бұрын
Ye that would be great
@soupnoodles
@soupnoodles 3 жыл бұрын
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 :)
@iliyarh
@iliyarh 3 жыл бұрын
@@soupnoodles facts 👍👌
@chadasonmcgraw
@chadasonmcgraw 2 жыл бұрын
I would say learning C++ would be the best for learning an RPG...
@RobinNeville
@RobinNeville 4 жыл бұрын
You legend. Giving each screen its own game loop is such a good idea.
@GeneralPet
@GeneralPet 3 жыл бұрын
I was wondering how I can encapsulate each screen and it's contents but never thought of separate game loops. What a legend
@RobinNeville
@RobinNeville 2 жыл бұрын
In hindsight (and having implementing the idea) I retract this comment. Each loop requires the same boilerplate setup (clock, event handling, etc).
@nicolaiv.9757
@nicolaiv.9757 2 жыл бұрын
@@RobinNeville What do you recommend then?
@dylanboyd6147
@dylanboyd6147 Жыл бұрын
@@nicolaiv.9757 using a gamestate stack
@chrisogb11
@chrisogb11 Жыл бұрын
@@dylanboyd6147 how would you go about doing that?
@Garfield91076
@Garfield91076 4 жыл бұрын
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!
@darealsooski
@darealsooski 2 жыл бұрын
it's more that people coming to these tutorials are new to coding (like me lmao) so it feels very smart and impressive
@zackydev
@zackydev 4 жыл бұрын
yes YES this is what i was thinking and this video immediately popped up youtube algorithm is good
@armaanveersinghsidhu
@armaanveersinghsidhu 2 ай бұрын
dude this is genius. i have been bashing my head over this stupid problem for so long.
@Amb3rjack
@Amb3rjack 2 жыл бұрын
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.
@fabihoerlnein8774
@fabihoerlnein8774 3 жыл бұрын
I have never used the commend section before, but today I got so much core input in 3 min... nice video and thank you
@rgblogic448
@rgblogic448 3 жыл бұрын
Watched tons of videos an didn't quite understand until watching your video! Great work!
@hugolml6538
@hugolml6538 3 жыл бұрын
You are a real benediction for us the beginners ! Thanks a lot !
@cardinel7918
@cardinel7918 4 жыл бұрын
Nice Video! A great explanation, easy and with no missunderstandings, such video I looked for. thanks man!
@LiquidLogic1
@LiquidLogic1 Жыл бұрын
This is a fantastic tutorial - very easy to follow and understand. Thank you!
@Foon2Death
@Foon2Death 4 жыл бұрын
No questions, just want to say I enjoyed the info and examples man. Thanks from someone using pygame and eyetracking for his thesis
@SchwiftyFingers
@SchwiftyFingers Жыл бұрын
You are amazing. ❤ Even Chat gpt doesn't make it this simple
@2MSTennis
@2MSTennis Жыл бұрын
Need more of this! If you could and have the time I’d like to see how you make a fully developed menu.
@theseangle
@theseangle 5 ай бұрын
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
@kefrov
@kefrov 3 жыл бұрын
This helped me so much, thanks man.
@RealBuzzerHours
@RealBuzzerHours 3 жыл бұрын
I somehow understand this now, so thanks a lot!
@ayushmoghe5767
@ayushmoghe5767 2 жыл бұрын
Thank you for this, wishing you best of luck
@sevcandincel
@sevcandincel 4 жыл бұрын
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!
@mikederino1412
@mikederino1412 3 жыл бұрын
thank you for making it simple
@emtydoctrine
@emtydoctrine 3 жыл бұрын
Great video that explains using different screens perfectly!
@dubpper98
@dubpper98 2 жыл бұрын
wow men! thanks a lot, very nice tutorial and very nice menus! :O
@angelluisgarciaguzman5598
@angelluisgarciaguzman5598 4 жыл бұрын
This is the part where you clutch that sweet-sweet inheritance quirk
@DeeMasta
@DeeMasta 3 жыл бұрын
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.
@discotrain173
@discotrain173 2 жыл бұрын
How do you code the menus such that you maneuver through them with arrow keys rather than clicking the buttons with your mouse?
@simplepycodes
@simplepycodes 4 жыл бұрын
Impressive work.
@tristandombroski9677
@tristandombroski9677 Жыл бұрын
I wish I could like this video twice.
@thequicklyid5699
@thequicklyid5699 Жыл бұрын
Very well made video!
@yardable1
@yardable1 4 жыл бұрын
genuinely awesome !
@noah_edwrds
@noah_edwrds 3 жыл бұрын
HAPPY BIRTHDAY !
@keerthipranavi
@keerthipranavi 3 жыл бұрын
this code helped us so much!! Thank you
@veiga757
@veiga757 3 жыл бұрын
Thanks a lot. Very helpful!
@yurii.okereshko
@yurii.okereshko 4 жыл бұрын
Finally found your channel). Really impessed with amount of work, good job, keep it going! P.S. Hello from Ukraine)
@moonis_iqbal
@moonis_iqbal 3 жыл бұрын
I liked the card menu most...!! May you explain please, how it is created in pygame ?
@LeQuietkid
@LeQuietkid 2 жыл бұрын
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)
@kunns123
@kunns123 2 жыл бұрын
@@LeQuietkid what
@marcellomarianetti1770
@marcellomarianetti1770 3 жыл бұрын
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
@blackgameneon
@blackgameneon 2 жыл бұрын
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)
@johnstarfire
@johnstarfire 4 жыл бұрын
Thanks, great explanation
@mindoasis.meditation
@mindoasis.meditation 2 жыл бұрын
Hello very important question, I have a project due and I'd like to know how to add text to these button?
@SchwiftyFingers
@SchwiftyFingers Жыл бұрын
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 😅
@b.manisha8291
@b.manisha8291 2 жыл бұрын
Hey how can i add text on button for this code
@srqubit9480
@srqubit9480 Жыл бұрын
Pls You can teach how to make a resolution selector and that absolutely everything adapts to the new resolution
@tristancummings5925
@tristancummings5925 3 жыл бұрын
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?
@wowgodz-5349
@wowgodz-5349 3 жыл бұрын
paste the code into the loop is faster
@external111
@external111 4 жыл бұрын
at 6:18 there is a button to go fullscreen, what is the code to make your Pygame window fullscreen?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Use the pygame.FULLSCREEN flag when you use .set_mode
@Katulo14
@Katulo14 3 жыл бұрын
some bug that occurs in linux, the options don't work and the button doesn't appear and the escape also doesn't work
@aliza4980
@aliza4980 2 жыл бұрын
Hi, iv copied the code but I keep getting an invalid syntax on the mx .. does anyone know how to fix that?
@gautamsharma9897
@gautamsharma9897 4 жыл бұрын
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
@dafluffypotatovr7362
@dafluffypotatovr7362 4 жыл бұрын
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.
@gautamsharma9897
@gautamsharma9897 4 жыл бұрын
@@dafluffypotatovr7362 Thanks for reply
@moonis_iqbal
@moonis_iqbal 3 жыл бұрын
And how to add a target... Please make a video on card menu tutorial for beginner
@2MSTennis
@2MSTennis Жыл бұрын
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)
@DaFluffyPotato
@DaFluffyPotato Жыл бұрын
You just keep blitting it so it stays
@2MSTennis
@2MSTennis Жыл бұрын
Thanks! I’ll try!
@madankrishnan633
@madankrishnan633 Жыл бұрын
how would you implement this same main menu like code for an in-game pause menu?
@khalvissi9303
@khalvissi9303 4 жыл бұрын
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 ?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Python variables are local by default. Pass the click variable to the function giving you the error.
@khalvissi9303
@khalvissi9303 4 жыл бұрын
@@DaFluffyPotato oh ok thank you !
@darien9834
@darien9834 2 жыл бұрын
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
@khalvissi9303
@khalvissi9303 2 жыл бұрын
@@darien9834 Hey, could you send me your functions, I'll check that
@darien9834
@darien9834 2 жыл бұрын
@@khalvissi9303 i messed around for a bit and it just stopped happening now but thanks for the reply
@ayoubdkhissi
@ayoubdkhissi 3 жыл бұрын
Thanks man you helped me alot
@luneye206
@luneye206 4 жыл бұрын
How do you implement the transitions between windows such as 6:10 ? Thanks in advance :)
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Just blit a black surface over everything at an increasing opacity. (and do the reverse afterwards) I'll probably make a video on it.
@luneye206
@luneye206 4 жыл бұрын
@@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 :)
@playonandroid9977
@playonandroid9977 4 жыл бұрын
thanks a lot dude, you're awesome
@GeikoTreyarch
@GeikoTreyarch Ай бұрын
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
@FPLogistic
@FPLogistic 3 жыл бұрын
THANK YOU SO MUICH DUDE
@dinistavares7263
@dinistavares7263 3 жыл бұрын
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 ?
@canadianjoker9124
@canadianjoker9124 2 жыл бұрын
How can i do this with classes, i have 2 games in its own classes, and a main loop. ,
@sabununicorn132
@sabununicorn132 2 жыл бұрын
Hi, how do you put a text inside the rectangle ? I don't quite understand it
@discotrain173
@discotrain173 2 жыл бұрын
When you draw the red rectangle, you just blit text after drawing the red rectangle
@jacobjrgensen4828
@jacobjrgensen4828 3 жыл бұрын
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
@cliffordwilliam3714
@cliffordwilliam3714 3 жыл бұрын
Would it be better to use state machine to make the menus?
@gecriser
@gecriser 3 жыл бұрын
Thank you so much
@doviledasilvamonteiro8439
@doviledasilvamonteiro8439 4 жыл бұрын
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. ...
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
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.
@AppyTheApe
@AppyTheApe 3 жыл бұрын
Can these codes be used in godot?
@miffycomes5881
@miffycomes5881 4 жыл бұрын
is there a command for start like for exit its exit
@victoraugusto313
@victoraugusto313 4 жыл бұрын
hello, how did you put the background image on the menu?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
You can put something in the back by rendering everything on top
@victoraugusto313
@victoraugusto313 4 жыл бұрын
@@DaFluffyPotato ok ok
@victoraugusto313
@victoraugusto313 4 жыл бұрын
@@DaFluffyPotato How to put a button so that when I press on options I can go back to the menu?
@itsME-dc4vm
@itsME-dc4vm 3 жыл бұрын
Nice ;D
@kelsierii4747
@kelsierii4747 3 жыл бұрын
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.
@josemiguelgomesteixeira9274
@josemiguelgomesteixeira9274 3 жыл бұрын
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?
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
You return from the game instead of calling the menu again so that it just goes back up to the menu.
@wandinho1111
@wandinho1111 4 жыл бұрын
Thank you!
@francisvincejaca4077
@francisvincejaca4077 2 жыл бұрын
how do u add images?
@hirossxD
@hirossxD 3 жыл бұрын
And how to do it in Pygame Zero ?
@philtoa334
@philtoa334 Жыл бұрын
Nice.
@alihadji9022
@alihadji9022 2 жыл бұрын
how did you animate them?
@GreenScreenKid284
@GreenScreenKid284 2 жыл бұрын
Ooooooppppp
@joshua_leyer
@joshua_leyer 4 жыл бұрын
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?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
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.
@edux73
@edux73 3 жыл бұрын
THANKSSSS!!
@Steppy
@Steppy 4 жыл бұрын
how do i make it so when i click on the game button it switches to the actual game?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
if click and mouse_r.colliderect(button_r): run_game()
@Steppy
@Steppy 4 жыл бұрын
@@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
@Steppy
@Steppy 4 жыл бұрын
@@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)
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
@@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.)
@coconaatti2878
@coconaatti2878 4 жыл бұрын
hi, can anyone tell me what does DaFluffyPotato game dev use for making the menu?
@daiwikdhar6464
@daiwikdhar6464 4 жыл бұрын
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!
@coconaatti2878
@coconaatti2878 4 жыл бұрын
I mean I used pygame and python in pycharm and didn't work
@daiwikdhar6464
@daiwikdhar6464 4 жыл бұрын
@@coconaatti2878 You need to install pygame and then import it... Search for it on youtube..."How to install pygame and use it?"
@coconaatti2878
@coconaatti2878 4 жыл бұрын
Oh ok thanks so much 😊
@daiwikdhar6464
@daiwikdhar6464 4 жыл бұрын
@@coconaatti2878 Np
@raisulislam3593
@raisulislam3593 4 жыл бұрын
How can't understand your map source code Please explain how to design a map Please please please 🙏😢🙏😥
@projectvibe1226
@projectvibe1226 4 жыл бұрын
he have a video in his pygame beginner series
@suspensed_
@suspensed_ 4 жыл бұрын
how did you make the rounded buttons?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
Those are images.
@suspensed_
@suspensed_ 4 жыл бұрын
@@DaFluffyPotato can you tell me how you did it please?
@suspensed_
@suspensed_ 4 жыл бұрын
@@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
@moonis_iqbal
@moonis_iqbal 3 жыл бұрын
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 !
@moonis_iqbal
@moonis_iqbal 3 жыл бұрын
@@DaFluffyPotato plz explain how to create clickable image buttons!!
@pain.wav_06
@pain.wav_06 4 жыл бұрын
your voice feels like a mixer-grinder
@fdevstudio5692
@fdevstudio5692 3 жыл бұрын
Hi, you work as what?
@voltifer5267
@voltifer5267 4 жыл бұрын
Hey, Can you make a levels tutorial?
@DaFluffyPotato
@DaFluffyPotato 4 жыл бұрын
That should be covered between the video where I implemented levels loaded from files and this video.
@spacegoat8559
@spacegoat8559 4 жыл бұрын
I guess .collide_point() is a thing lol
@dafluffypotatovr7362
@dafluffypotatovr7362 4 жыл бұрын
Yeah, I didn't find out until last year for some reason.
@programmingonly6538
@programmingonly6538 3 жыл бұрын
You speak like a drunk (do not offend bro i am your biggest fan)
@eggmeister6641
@eggmeister6641 3 жыл бұрын
but the stack tho...
@одинитолько
@одинитолько 3 жыл бұрын
just let me steal the code... im too tired for this rn
@bornamusulin2557
@bornamusulin2557 3 жыл бұрын
help my boy lubina he have 2 hours or dead
@bornamusulin2557
@bornamusulin2557 3 жыл бұрын
yes he is
@manyk6971
@manyk6971 5 ай бұрын
3:14
@grimreaper7648
@grimreaper7648 2 жыл бұрын
noob
@vialomur__vialomur5682
@vialomur__vialomur5682 3 жыл бұрын
Thank you!
Framerate Independence - Pygame Tutorial
3:33
DaFluffyPotato
Рет қаралды 23 М.
Pygame's Performance - What You Need to Know
9:11
DaFluffyPotato
Рет қаралды 207 М.
МЕНЯ УКУСИЛ ПАУК #shorts
00:23
Паша Осадчий
Рет қаралды 2 МЛН
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 15 МЛН
Pygame Menu System Tutorial Part 1: Game Loops and Structure
18:26
"Balancing" Gamedev and a Day Job
8:50
DaFluffyPotato
Рет қаралды 78 М.
Learning Pygame by making Pong
28:39
Clear Code
Рет қаралды 208 М.
How to Code (almost) Any Feature
9:48
DaFluffyPotato
Рет қаралды 696 М.
How to Crack Software (Reverse Engineering)
16:16
Eric Parker
Рет қаралды 697 М.
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
Pygame CE - Better & Faster
6:29
DaFluffyPotato
Рет қаралды 39 М.
2 YEARS of PYTHON Game Development in 5 Minutes!
4:54
Coding With Russ
Рет қаралды 957 М.
Creating an animated button in Pygame
32:49
Clear Code
Рет қаралды 35 М.
МЕНЯ УКУСИЛ ПАУК #shorts
00:23
Паша Осадчий
Рет қаралды 2 МЛН