Here's a tip: VSCode shows the current object and function I'm editing right under the file tabs, which can help you keep track of where I am at all times. Clarification: If you have larger entities, they need to look up a larger area of tiles around them for physics. I used a 3x3 table in the tutorial, but you may need a larger one for large entities. A 5x5 table would be every pair of numbers between -2 and 2. (3x3 is -1 to 1) As of the release of this tutorial, I'm still using Pygame CE. They've actually released another update since I started working on this video as well!
@rubendriezen7177 Жыл бұрын
I made my own programming language in python!
@herikgiammaria9961 Жыл бұрын
I love your work!! I love love love it, I study pygame for your videos and I try to improve every day! Could you put subtitles in this video of yours? I'm Brazilian and I don't understand your videos very well when they don't have subtitles
@DaFluffyPotato Жыл бұрын
@@herikgiammaria9961 I think KZbin may still be processing the automatic subtitles. There's no way I could write up manual subtitles for a 6 hour video though. I just do manual English ones for my scripted videos now since I can just put in the script. Also, I'm impressed that the automatic ones are useful since it often doesn't understand what I'm saying.
@herikgiammaria9961 Жыл бұрын
@@DaFluffyPotato Thank you very much!!!! I thought so haha, after all it's a 6 hour video! KZbin must be processing, I'll come back to watch it later! MT thanks for helping this community to grow, I appreciate you and your work, hugs
@AndrewHTR Жыл бұрын
@@herikgiammaria9961 salve herik
@thes_ntry Жыл бұрын
You are a wizard of using Pygame, your previous tutorials were amazing, and the amount you've been able to build up around the library is immensely impressive. Thank you for sharing your experience and insight to everyone
@Z3gn1c Жыл бұрын
Just finished this amazing tutorial, took me about 4 days though spent about 18hours on it. But it was worth every second! This is the first time I actually worked with Pygame, and after your tutorial, I definitely have quite a few ideas of what I can do on my own. Will be checking out your other tutorials as well. Thanks for some amazing content !
@holon466213 күн бұрын
This tutorial is amazing. I am about 3 hours into it and my "selfmade" map editor is almost finished. That's the coolest thing I created in Python so far. Thank you so much for the excellent walk through for all the mechanics. It saves me several hours I would need to study and understand the Pygame library from the documentation.
@pistondev220412 күн бұрын
true bro I am also grateful for him that we got these tutorials in youtube easily, imagine people making games in 2000s where these things didn't existed
@emperor8716 Жыл бұрын
this is crazy. a tutorial from the actual best, i can't wait to do this.
@nilusnilus6365 Жыл бұрын
wow i remember a few years ago following your platformer tutorial, very glad to see you continuing the series :D
@VolarGorilla9172 ай бұрын
Words cant describe how thankful I am for this dude. I love coding, and i also love playing video games. I wanted to get into game dev and i have made a few games and have worked with a few pathfinding algorithms (i implemented Dijkstra's GBFS and A* in snake and a cool little maze solver), I wanted to get into making better games, making platformers specifically. But I was never able to get past making a player move around, I'd always struggled with the scope of the project and the concepts of how to make my own tilemap / tile editor and I especially struggled with collisions using tiles. Ur a wizard dude, some of these solutions u came up with to the problems i struggled with are so simple. I really appreciate you making this long tutorial that explains all of the code and even the math, most tutorials dont bother explaining the math, they just say "oh this is just how you do this". They dont bother to explain what it is or how it can be applied, and that goes for all of the code. I love that you stopped, backed up for a second and explained the code, how you can change it, and several different applications for the code. Sorry for rambling dude im just really thankful.
@DarkPlaysThings Жыл бұрын
Thanks so much for the great tutorials! It’s awesome to see your thought processes and see how you make such high quality experiences using python!
@ZaynBrando11 ай бұрын
This is actually the best video i've ever seen that explains things very easily for a beginner and helped me understand the "WHY" behind every code. Thank you so much, subbed!
@sricharanathanti318111 ай бұрын
This guy has to go down in the books as the best Python game developer.
@galaxybrainnews9772 Жыл бұрын
After the optimizations around 1:52:15 I adjusted the tilemap __init__ to add a million tiles in each direction instead of just 10. it took a while for the project to start but even with 2 million tiles loaded into the tilemap it was still buttery smooth once it got going! (Using python 3.12 and pygame ce as of 11/9/2023)
@DaFluffyPotato Жыл бұрын
Yep, that's expected. You can have some pretty massive worlds. Often times RAM will become an issue before CPU usage in those cases (provided you don't have too much on the screen at once).
@lucaivaldi45208 ай бұрын
@@DaFluffyPotato I wonder if the optimization is more about not having to query the whole dict more than queuing a lot of draw calls. Of course premature optimization is the root of all evil and we should always benchmark before trying to optimize. I think the SDL library (and the backend it uses, Opengl, Metal, Vulkan..) will be more than happy to discard any draw call that draws off the screen, but there is the cost of querying the whole dictionary anyway, so your solution could cut the time spent there. Anyway, I'm not sure how much of an issue that could be. Anyway, this is only something I'm asking myself and your videos are super, thank you!
@stephan199127104 ай бұрын
I am exactly halfway in after 3 days, and I can't believe this is on KZbin for free... It's amazing for beginner/intermediate level. Thank you so much for this
@JamieKilduff Жыл бұрын
So happy this was uploaded, couldn't find a better person to explain pygame then this legend, Well done Potato keep killing it
@SagaContinu Жыл бұрын
If anyone runs into an issue with their character falling through the floor: Collision detection is checking where you are located in the a grid system ---> that's what the tiles_around() function does. It uses the co-ordinates from the top left of your player image to workout where you are. If your player image is larger that the grid system it will only register that you are in the next grid section to update the collisions after you have fallen through the floor. Try checking from the center of the image instead. Or else you may need to do more than one check i.e. top left, bottom right. Or else increase the checking distance to include more tiles. Interesting way to do the collision detection though
@HammouaI0I0I08 ай бұрын
how to do this btw
@SagaContinu8 ай бұрын
@@HammouaI0I0I0 Adjust tilemap.physics_rect_around() function to check from the center of the player instead of the top left player_loc = self.game.player.rect().center However, if the distance from the center of the image to the sides (right,left,top,bottom) is still greater than a tile width this won't work.
@HammouaI0I0I08 ай бұрын
@@SagaContinu cool, but where do i insert this line of code edit: cool my player doesn't fall trough the wall, but its sometilmes glitch out with upper collisions
@IfYouEscapedYTKidsIWillGetYouАй бұрын
@@HammouaI0I0I0 by learning pygame and python
@fuzzy-026 ай бұрын
I loved this tutorial because I wanted to learn practices, techniques and general tips on how to write the code, more so than learning the syntax which can be easily found from the docs. I was happy when you shared how you do things and how you write them every now and then. Thank you so much!
@АлексейШтейников-ц4ц Жыл бұрын
I think you are the only developer who works so hard on making games in python, knowing that it was easier to do it in unity. You really inspire me a lot.
@DaFluffyPotato Жыл бұрын
It's only easier to get started learning with Unity. At my level, I can work faster than people using Unity.
@chigstardan7285 Жыл бұрын
@@DaFluffyPotato That's so cool.
@sushismitcher225 Жыл бұрын
I have been using pygame for over a year, and I've made over 20 pygame snippets in vs code to make anything in pygame from particles to a basic platformer. This lets me make prototypes faster than with a game engine. Each method to making a game has its advantage.
@Man-mx2sy Жыл бұрын
nah check out clear code, that dudes fire
@chigstardan7285 Жыл бұрын
@@Man-mx2sy man clear code is the best, though he uses pygame for educational material while fluffy uses it for his personal projects. I hear clear code is gonna bring a new Godot 4 tutorial.
@daniehexer7016 Жыл бұрын
It's great seeing your tutorials, can't wait to try this myself!
@Plexus373 ай бұрын
Awesome, thanks man. Just started with Python after 30+ years of doing nothing. I learnt Pascal, COBOL and C at college, its coming back quicker than I expected but a way to go.
@gibran80011 ай бұрын
This smooth camera movement trick is fucking amazing. I had to go over the geometry of it a couple of times, but once it clicks, holy shit, it makes so much sense.
@Programmer-Anchous Жыл бұрын
This is the best pygame platformer tutorial I've ever seen! Thank you!
@jumparoundtheatoms Жыл бұрын
Awesome stuff you did sharing this , many thanks :) . One thing for those who made it to enemies :P : while DaFluffyPotato does mention and switches to off grid placement for the player ( and subsequent the enemies ), if one does place the spawners by accident on grid like me, extract will fail. This is because the spawners are not part of self.offgrid_tiles, but self.tilemap, and the loop in the extract function its done on the self.tilemap directly and not on a copy. Reckon by accident and the loop should be done on a copy to catch this cases.
@Nolexes8 ай бұрын
I totally overheard the offgrid part couldn't get my game running anymore and got different kind of errors trying to fix it so thanks for the comment. I bet it would have taken me ages to find this out on my own :D
@curiousstudent7961 Жыл бұрын
my coding got so much cleaner from using this as a guideline, thanks!
@RAM-nb1ot Жыл бұрын
I was literally following your old pygame tuts and if they werent alr a blessing we got this :) thanks man
@willwillcode7568 Жыл бұрын
Finally, a good tutorial on pygame! Thanks so much
@moanzx2 Жыл бұрын
this has helped me so much now im hooked on your videos :) also remade my platformer im working on thanks to so many of your techniques. and joined the discord and there are so many helping people there! looking forward of what your'e gonna do next! 😊
@PeterDinklager Жыл бұрын
Around 32:34 a good practice is to stop and try to code in left and right movement, then add a collision box on each side at equal distances. Helped me understand the code and get a better grasp for placing things in relation to the resolution
@sc2sperwerfy24911 ай бұрын
hey, do you know witch event i have to use for the key right and key left? I cant find them in python. thanks
@kuba.910811 ай бұрын
@@sc2sperwerfy249just normal eventtype K_UP or K_DOWN i belive
@StayInNeverland17 ай бұрын
@@sc2sperwerfy249 K_LEFT and K_RIGHT
@LemmonTea2 ай бұрын
I figured out how to add left and right, it was actually cool to try and figure it out on my own
@paranimias11 ай бұрын
on 2020 you totally saved my butt on my programming project with your first tutorial, I'm really glad that you keep posting this tutorials, greeting from Colombia!
@official-phuh7 ай бұрын
I've been trying not to comment until the end of the video, but right now I'm in the middle of making the Level Editor and I just have to say, things are really starting to click and I'm really grateful for your teaching style, optimization/pragmatism/problem solving, and effort to make this tutorial. I'm changing things around too as to really push myself to understand your code more thoroughly (for example I used a sprite sheet that needs coordinates instead of files for the Level Editor, which required a fair bit of tweaking across multiple files).
@carrotsandcats Жыл бұрын
Thank you so much for this, it’s so cool that you « remade » your old tutorial séries and improved it!! Thx
@cursorop1716 Жыл бұрын
at 1:33:00 if you divide self.scroll by 30 then the camera follow up will be slow . If you jump from high distance your player will fall first and camera wouldn't be able to follow up player , so divide it by 20 so no matter how high you jump the camera will follow up player in slow manner but without losing its track .
@anameanother35574 ай бұрын
thank you so much
@RickyRunyan-y1bАй бұрын
Haven't finished the thing yet but any one that will give 5+ hours of their time is doing such great things for other people. It's amazing that a person can get this free by watching some ads. That's a great deal, honestly. Don't hate ads. It's a great system.
@ZedTheThrid5 ай бұрын
13:20 To place an icon icon = pygame.image.load('Your file here. I recommend it being in the same folder, but u could also put the file path I think') pygame.display.set_icon(icon)
@musaplusplus Жыл бұрын
God damn Fluffy , you really went in with this one
@joshbarros1995 Жыл бұрын
Oh my god!!! its soooo perfect!!! I'll take this tutorial this Saturday!!!
@ekaterinamalinkina389911 ай бұрын
What a great tutorial! Clear, concise, and not tiring to watch :) feel like i got a lot from this, thanks
@prafultimbadiya9891 Жыл бұрын
Your graphics are AMAZING!! ❤❤
@lustrias Жыл бұрын
Amazing tutorial. I've tried a few others, but this one is just what I needed. I do deviate here and there from your code. I added vsync to the window. But vsync only works with the flag pygame.SCALED. So I removed your method of scaling (drawing a 320*240 surface and then upscale it in the main window). The amount of experience and information you give is really impressive. Thank you so much👍
@sourcream1671 Жыл бұрын
This is amazing, brilliant work!
@Rafaeldonfigueiredo Жыл бұрын
It's another great tutorial, Fluffy. Thank you
@thisisnotkj Жыл бұрын
thank you for the great tutorial :D, will be watching it over the coming days!
@subnatiby Жыл бұрын
HOLY MOLY A NEW ONE!!!
@DerpyDungeoneer Жыл бұрын
I almost cried not finding that typo that didn't let me start the game at the end of the cloud part. Dude I love your insights you give into various methods of handling stuff. Super abstract thinking. I aspire to get on that level at some point. This is my first step into game development. Hope I get my mind primed the right way following your thought process.
@Chez19-f2x4 ай бұрын
Great video btw thank you so much and also answering my question !
@LukaGantar Жыл бұрын
Thanks a lot for this, the tutorial is a great, comprehensive intro to pygame!
@q1chen Жыл бұрын
It took me several days to finish it and i really learned a lot, thanks!
@nowty8831Ай бұрын
This is amazing, thank you so much!
@_am_i4 ай бұрын
Many thanks for this tutorial with detailed explanation and guidance!!!
@DarkblooM_IO6 ай бұрын
Super cool video, thanks!
@bini420 Жыл бұрын
I did not expect a banger like this from you, I went from "oh new 10 minute video of his old tutorial" to "course? So 1 hour? That's unexpected" to "bros brain turned to mash patatos of he done this"
@isaiah36136 ай бұрын
thank you for making this can't believe i finally made it through this "7" hour tutorial
@Chrotesque Жыл бұрын
I imagine this is the most random feedback ever but I just came from your video "How to Code (almost) Any Feature" to this and have to say that you improved the way you talk in these videos immensely!
@tas476 ай бұрын
I really appreciated the video! if i can add something is whenever you are explaining a concept, visualizing the physics with drawing on a white board would really help reinforce the explanation.
@DaFluffyPotato6 ай бұрын
The full physics video I referenced has that.
@tas476 ай бұрын
@@DaFluffyPotato The video with the drawing was very well explained! I wish we could have seen more concepts in that format.For example , before coding certain topics such as camera movement ,and tiles creation, you often start explaining your thought process. I wish we could have seen some visual representation on those thoughts because words can be overwhelming. Other than that I loved the A to Z tutorial! Thank you so much for the content.
@FaunFunc Жыл бұрын
i just migrated to pygame from html and js canvas, am skimming through this tutorial and it's very fun. Learning OOP for games is really worth it🙂
@naturep1x3ls Жыл бұрын
the ultimate pygame tutorial has arrived.
@curlydev2 Жыл бұрын
THANK YOU SO MUCH, Thanks to you i achived my rpg engine, and it's so fast ! I'm really happy
@breadman7733 Жыл бұрын
Just what I needed in my life. Thanks so much !
@mojojojo123 Жыл бұрын
Thank you for sharing!!! This is such a great tutorial :)
@matiasgarciacasas5585 ай бұрын
This is an incredibly valuable resource
@arbitervildred8999 Жыл бұрын
you can actually do something about that camera bug when it gets closer to it's target, I believe you can target more of a radius of 5-10 pixel from the player origins, so once it gets closer to the player it will stop trying to center it perfectly and avoid the bug (but of course, the player will be slightly offset by 5-ish pixels) OR when it gets to that 3-5 close pixels, suddenly speed the camera from 30 to 100 so it gets spot on in maximum 2 frames (about 1:35:50)
@khushankgalgat Жыл бұрын
hey, can you please tell what camera bug are you talking about? i didnt understood what "choppy" movement sir is talking about? Please explain that bug in some detail.. Thank You Have a nice day!
@justin7oo994 Жыл бұрын
This is actually really cool, I have never seen anyone use Json files for loading maps I have only used csv files that's such a neat trick, also another neat trick for even more performance, use orjson instead of normal json its much faster
Good afternoon! This tutorial is very useful, I have learnt a whole lot. Thanks . Respect+
@unknownMusk Жыл бұрын
Wow! It's a big work!! You are so cool!!!
@parzival58846 ай бұрын
Holy shit dude u got my sub love the videos man keep up the good work! Im not a beginner but this helped me to brake that wall to be able to cold alone without the need of videos!
@oaklemon19207 ай бұрын
Thank you very much sir we needed just this. You are pygame god.
@EduTechNeer19 күн бұрын
To All my fellow learners using MacOS at time stamp 2:37:03 for the level editor I had to use the "z" key for scrolling through the different variant types in a group instead of LSHIFT. Best I can tell is MacOS reserved certain key combos for other functionality and it overrides pygame-ce functions. There may be a more elegant solution but I simply used the "z" button which is right next to the shift key. I love my Macbook Pro but the more I get into this the more I see developing on MacOS kind of sucks. I am a total noob at this but now I understand why some things may only be developed for one or the other because of all of these little items like key combos.
@flor18gatar Жыл бұрын
Immensely grateful for this. Thank you.
@wenxiali3 ай бұрын
I love your project your the best youtuber!!!
@q1chen Жыл бұрын
i literally said wow at the jumping part, genius idea
@Forakus11 ай бұрын
This is so incredibly valuable.. thank you
@wuziq5 ай бұрын
1:09:47 the double slash does floor division. the floor for negative numbers is more negative.
@wkol11208 ай бұрын
Hi DaFluffyPotato, through your teaching video, I learned about the python construction and many useful skill about game development! Especially on python container, it did help me a a lot to understand the syntax and tips. Thank you for your kindly sharing~~~
@jasonfun40697 ай бұрын
I learned more from this tutorial than my past 2 years of python classes
@yds6268 Жыл бұрын
This deserves a million views
@BumpDev Жыл бұрын
The ultimate course
@j6355 Жыл бұрын
Around 1:12:25 I ran into a problem where I wasn't able to print the tiles from around the player as they were falling, after downloading the code, comparing them side by side, copy and pasting over my own code with yours in some places to determine what was actually different, it turns out I had the "return" function on the wrong indent within tiles_around I would have never caught something like that on my own and could have been very frustrating to troubleshoot without the example code. Now I have another thing to add to my list of things to check if stuff doesn't work as it should and hopefully this problem wont catch me off guard next time. Just saying thank you and posting in case anyone else has a similar issue.
@trumansmith7630 Жыл бұрын
Nice find, my character kept falling through the tiles. Could have sworn I wrote the PhysicsEntity wrong... but nope! Wrong indentation! Don't be like me, check your tabs B^) thanks for commenting
@koufdell Жыл бұрын
amazing content..thank you so much..exactly what i am struggling with...
@gusthebunny92384 ай бұрын
Thank u so much,best tutoring in the world,great work.
@Jioarg Жыл бұрын
This is a great tutorial. Some things I would like to see is a tutorial on a way to implement 3d isometric levels(editor and player) and menus and sprite sheets as assets. Thank you for all of your help.
@DevNug Жыл бұрын
This seems like a good approach for people who already know how to program. Honestly some of the APIs seem similar to normal web dev. I guess at the end of the day, game dev is still just listening for events, updating state and rendering to the display
@joon9360Ай бұрын
At 1:50:00, wouldn't using f-strings be faster? Like loc = f"{x};{y}" instead of loc = str(x) + ';' + str(y)
@deecyrlysons3401 Жыл бұрын
Tutorial done! Thank you for this...from France
@doganaktar Жыл бұрын
thanks a lot dude you're the best
@viniciusamaral3085 Жыл бұрын
Man, thank you so much for this...
@mobs930610 ай бұрын
Following this series with Zig and Raylib pretty similar experience except a lot of low level concerns.
@villageraxo3988 Жыл бұрын
Thx potato i was looking for a tutorial like this
@sopvop10 ай бұрын
Great video! I've learned a lot of basics about side scrollers, even though I'm following with c++ and raylib instead of python.
@friesguy54676 ай бұрын
2:21:20 for me, this doesn't run even when I use the sample project. I get an error in the entities.render() method. surf.blit(pygame.transform.flip(self.animation.img(), self.flip, False), self.pos[0] - offset[0] + self.anim_offset[0], self.pos[1] - offset[1] + self.anim_offset[1]) TypeError: invalid destination position for blit Not sure what's going on there... I see it now. I need parentheses around the destination parameters.
@lodybaguette2487 Жыл бұрын
Good work !
@drewfrench87843 ай бұрын
I believe the top left thing for graphic graphing came from how old televisions would illuminate the screen
@tortutute1707 Жыл бұрын
I don't comment much on videos, but thank you very much for your videos which help me a lot. Keep it up 🔥🔥! sorry for my english i am french
@thefunnyegg-fe8lr9 ай бұрын
thank you!! pygame is tricky but i'm determined to get it down!!
@TarunThakur-go4qg Жыл бұрын
hello big fan i have created my own game thanks to you
@Tristaxx10 ай бұрын
MAN THIS IS FRICKIN LIT 🔥 thx man 🗿
@brianbrooks44486 ай бұрын
So you can load media assets as a dict ? self.assets = { 'player': load_image('entities/player.png') } wow , didn't know that. This is excellent stuff
@LemmonTea2 ай бұрын
Yeah, me neither
@ZaneBarrowАй бұрын
Have you considered making a video explaining what each component of pygame does and how it is used?
@DaFluffyPotatoАй бұрын
I'm hoping to do that soon. It would be more useful for experienced developers learning Pygame.
@sleepless21327 ай бұрын
48:18 I'm getting module object is not callable not sure what I've done wrong. not sure if I'll get an answer but thought I'd ask before I go to bed to refresh my mind.
@DaFluffyPotato7 ай бұрын
Compare with reference code
@anantpankaj14604 ай бұрын
at 48:15 i cant understand the precedence of displaying surfaces ,plz help...well now understood
@LuicMarin5 ай бұрын
Loved the tutorial, hope we see one where we do some boss monster patterns
@Chez19-f2x4 ай бұрын
How is 'offset[0]// self.tile_size' the top left of the screen i don't get it at 1:48:17 thx :)
@vandanasinha32624 ай бұрын
I had the same question
@Chez19-f2x4 ай бұрын
I was also having trouble wthe bottom right as well 😅😅😅
@DaFluffyPotato4 ай бұрын
The camera offset (passed as offset there) is the top left corner of the "view" in the world's pixel coordinates. You perform an integer division by the tile size to get from pixels to tile coordinates so you can look up tiles based on the camera position.
@Chez19-f2x4 ай бұрын
Thank you so much for the explanation :D
@Chez19-f2x4 ай бұрын
i didn't understand how the camera was working I think that was the problem i was having