Dude seriously, THANK YOU. The fact that you put in all this work to teach us this stuff is amazing. Just goes to show how much you care. I'll support anything you make!
Can we like the video 3 thousand times in a row? Dude, I work with written documentation, and I know the amount of fucking work that goes into explaining every single little detail. I've done a couple of explanatory videos before. Nothing comes close to the level of detail and the dedication that you put into your videos. They're very helpful! Thank you very much for putting up this kind of content! It's a blessing for people learning Python and game development in general!
Thank you so much for all the time and effort you must have put in making and preparing this video!! It was not only helpful in getting to understand pygame, but also more generally how to organize the code with classes. Many thanks, job very well done! :-)
for those who run into an issue with pygame and mp3 files: from my short dive into it, apparently mp3 is really finnicky on pygame, and some combinations of app versions and OS lead to pygame unable to load mp3s; this was true for my Windows 10 and latest versions of all software. the solution is either skip the mp3s or use/convert to the recommended ogg or wav format (wav didn't cause me no issues).
If you enjoy this video check out my course: www.udemy.com/course/learn-python-by-making-games/?referralCode=A80FECE8C76096E01111 and my Patreon: patreon.com/clearcode
Wow, I just finished your Zeldalike tutorial and was thinking it would be easy enough to try making this exact concept, you sure work fast. Looking forward to checking this out in detail as well. Thank you for providing these!
Love these game tutorials but how to protect pygames and e.g. sell them? Compiling them to exe or multiplatform. What would be the best distribution posibilities? Perhaps a nice idea for a video:)
Really appreciate the fact that you're making all this for FREE. BTW, your paid Udemy course is very good for the price! Keep up the good work, you're a great YTber!
Finished this tutorial today. Just want to say thank you for a great video. Really learnt a lot of really neat tricks, and I think you have cleared up some of my confusion regarding object interactivity and importing. Great video...
At 46m09s, for the mechanism to make the frames repeat, instead of using an "if statement" you could use a module operator (%). It is faster (since it wouldn't need to do comparisons all the time) and cleaner (onli one small line of code) Short Example: frame = (frame+dt*4)%len_anim
Just completed the tutorial - took me about 16 hours total. Wow! Can't believe something like this is free. Learnt a lot and was really fun to learn something new and see/play the final finished game. Would love to see videos on the following types of games uisng pygame: - card game: yu-gi-oh style - pokemon style game - in particular aspects of changing maps, saving files and the turn based battle styles. - A game which utilies random map generation to build worlds for a top down game - A game which has dynamic world - I guess similar to this tutorial but with animals having behaviours that can interact with one another without player input. I will be going through your Zelda tutorials and Mario Maker ones too. Keep up the good work. Thanks !
hi what IDE did you use? im using pycharm and i dont know why it keeps on saying “video not initialized” and “Game” has no attribute “clock”” even i typed the same thing as Clear Code does. ive been having the same problem from my first code but i dont know why this errors keeps on popping up for me. 3:31 and a lot of errors happening already :((
i finished the pygame introduction video by him but idk why im having this kind of problem :((( i would be happy to have help since im presenting this as my final project
Hi, I used VS code. I haven’t used APY charm before. I’m terms of where you are getting stuck. Don’t worry. I also encountered MANY bugs that I had to overcome - I will say 99% were small typos and other bugs. Potentially start again (as you’re not far into it) and try to write everything from scratch. OR re-download the starting folder and then remove anything which got added before folder was pushed to the repo.
This is awesome!! Your videos inspired me to further my education. For that you have earnt my money sadly I don't have any yet but when I do I wont forget you ClearCode! Thanks again
Thanks you for this great video ! I'm at 32:30 and just in case there's too much animations you can use os module to check for any folder name to create the keys for the assets dictionnary. By using dictionnary comprehension you can also fill it and if you add or remove animations the process work by itself ! 😊
You might want to load stum_surf and apple_surf in the level module, and then pass them as arguments inside the Tree class, so you won't call the pygame.image.load function for every tree that has been created and you might gain a lil amount of memory and speed :)
I Love this type of videos! But I have a good idea for the next… can you try to make a game like this BUT with online multiplayer? It would be amazing but keep the work up I like it!
At 1:45:12 I used the following shorter and faster code to display the sprites. The idea is to sort the sprites by layer, then display. This eliminates the outer for loop as well as the need to use LAYERS dictionary. for sprite in sorted(self.sprites(), key=lambda x: x.z): self.display_surface.blit(sprite.image, sprite.rect) Later in the video at 2:17:05, the video shows how to add the sprite's y-position to further control the display order of sprites on the same layer, whidh would seem to require the original nested for loop after all. However, I incorporated the change into the above for loop as follows, keeping it a single loop. (Note that this includes the offset logic for the camera motion which the video added in the meantime): for sprite in sorted(self.sprites(), key=lambda sprite: sprite.z * 10000 + sprite.rect.centery): offset_rect = sprite.rect.copy() offset_rect.center -= self.offset self.display_surface.blit(sprite.image, offset_rect) The idea here is to create an integer key formatted as zzyyyy where zz is the layer number (the z attribute of the sprite), and yyyy is the y-position of the sprite. Now the sprites are sorted by z (the layer) and then by their y-location, drawing sprites in order from top to bottom, resulting in lower sprites appearing in front of higher sprites on the same layer. By the way, ditto to all the other compliments that others have made for this excellent video lesson!!
In Python, you can gracefully sort by multiple things using tuples! sorted(sprites, key=lambda sprite: (sprite.z, sprite.y)) This sorts first by earlier items in the tuple, then by later items. No need to assume y < 1000, or do any math. Hope this helps
@@pianoplayer1262 Do you have any idea how to make the sprites sort properly. Currently his rabit still appears infront of a flower for example when hes halfway up the stem instead of switching behind it when his feet pass the base of the stem. Its really offputting and i tried to sort based on midbottom of the rect but that had no effect
For those who are struggling with walk() function: you probably missed slash or smth. pathlib library is more comfortable to debug so you may want to discover it
is anyone getting a strange bug where when you run the code the first time, everything runs smoothly. But all subsequent runs, certain assets dont load in, specifically the apple sprites and particle effects. Only after saving a bunch does the issue resolve itself for one more run, then it repeats. It almost feels like certain chunks of code isnt running at all. Even when i run the code downloaded straight from the tute, its the same issue. I cant for the life of me figure out wats going on
I think the issue comes from using the groups() method. Try passing the self.all_sprites group into the Tree instance in the level so that you can access it in the Tree class. Instead of calling the group() method, use the all_sprites group. For some reason pygame doesn't keep the groups in the same order every time you start the game. This ensures that the apples are in the all_sprites group every time and should fix your issue
Clear Code your videos are awesome, they helped me so much, my request, if you would like to, then please create a video on how to solve problems, implement them in code. Thank You!
I wanna make it but in Unity or Godot The art is too cute to resist💖💖💖 Hopefully the video will help from a logical point of view and I'll find out about syntax later 😊😊😄
This means that the walk() function couldn't find the folder, which probably means that you misspelt the file name, or you code editor is running your code from a different location from your python file. If you're using VS Code, open the 'code' folder and run you game from there. You'll have to view you other files from file explorer, but I haven't found a better solution yet.
In the "Working on the trees" part, when I use the ax to hit the tree, the "tool use" keeps repeating several times, as if I were holding the space, so when I touch the tree it breaks automatically. Can someone help me?
Hello how are you? I'm Brazilian, I'm using google translator to send this message, so the sixtaxe and verbal agreement can be very bad... I would like to thank you for all your teachings, you are an excellent teacher... As a video suggestion , it would be very interesting if you made a tutorial where you create a game using the Box2D library.
I'll try my best to watch this and follow along, even though I have only about two hours after work before I should go to sleep: Day 1: 00:00 - 7:09 (an hour of progress, most of the time spend on learning about delta time) Day 2: 7:09 - 31:35 (an hour of progress, ate a bit also) Day 3: 31:35 - 48:32 (an hour of progress, was a bit stuck at one point but prevailed) Day 4: 48:32 - 1:09:05 (forty minutes of progress, was just tired idk) Day5: 1:09:05 - 2:03:38 (a couple hours of progress, was my day off!) Day 6: 2:03:38 - 2:03:38 (0 progress, hadn't any time unfortunately) Day 7: 2:03:38 - 2:03:38 (0 progress, hadn't any time unfortunately) Day 8: 2:03:38 - 2:03:38 (0 progress, hadn't any time unfortunately) Day 9: 2:03:38 - 2:03:38 (0 progress, hadn't any time unfortunately) Day 10: 2:03:38 - 2:33:46 (an hour of progress, my god it was intense, I don't understand almost nothing at this point, feels like black magic)
hey about the part at 21:45 with storing floats in rects issue and the need to store it in self.pos, pygame-ce comes with 'FRECTS' that can store float values
In the recent version of pygame (pygame 2.5.2 (SDL 2.28.2, Python 3.12.2)), it seems that the order of groups is not kept as is (but nor everytime). I added "self.group0 = groups[0] if isinstance(groups, list) else groups" before the call to super in the Generic class and replaced all the self.groups()[0] by self.group0 to get around this problem...
i ifnd the solution to error "list out of range" on vs code you have to "for animation in self.animations.keys(): full_path = './graphics/character/' + animation self.animations[animation] = import_folder(full_path)" instead of '../graphics/character/'
Why does it not show apples and particles after I run the python, one out of three times. I've tried deleting cache, changing IDE. When I opened his project s12 Particles. It also often times did not show any apples or particles on the screen. Any idea what's going on?
In main.py in line 20 (about 6:29 into the video), I would expect a statement like: dt = pygame.time.get_ticks() / 1000 The line as it is currently seen in the video does not seem to work on my machine...
@ClearCode Hi sorry To ask again but i was wondering could you maybe like add a pt 2 of this tutorial it would be helpful where i can at least add a tutorial, play screen with settings and even a pause menu with save game and stuff like that because i am not good in pygame but love the tutorials and i would like to do more and make it my first completed game thx.
He i have the same Problem with the Apple that they are not drawing after the trees. Its something withe the pygame groups. def create_fruit(self): for pos in self.apple_pos: if randint(0, 10) < 2: x = pos[0] + self.rect.left y = pos[1] + self.rect.top Generic((x, y), self.apple_surf,[self.apple_sprites, self.groups()[0]], LAYERS['fruit']) the thing with the self.groups()[0] dosnt work :( can someone help me?
Can you make a video on how to make an MSM fan-game in unity? i wanna be like rz (Raw Zebra) but you probably don't know what MSM is, so i recommend you get an understanding on what MSM (My Singing Monsters) is thanks. if not, that's ok.
Great tutorial! I've just completed the tool use section, and found that all of the animations play in reverse. Even downloading your code and running that does the same. Swapping the names of the animation files go from 1 to 0 works, but I'm wondering why it would do that in the first place? I can't find any reason it would do this especially if your code also plays in reverse as well. Any ideas?
For loccision hitbox why did u separate to self.hitbox.centerx and self.hitbox.cerntery instead of using self.hitbox.center = self.rect.center? I think it is cleaner.
hello, thank you for this tutorial and many other that have helped me improve a lot. at the part where I'm importing the tiled data into the loop, if I copy your exact code I get the error: "Cannot find tileset file ../../old/tilesets/Hills.tsx from ../data/map.tmx, should be at (my info)\old\tilesets\Hills.tsx", where it seems to refer to a directory called "old" which doesn't exist in your project files. after that I had to move the graphics file as well according to where the console wanted them to be, which was base project level. I assume Tiled has built-in info into the map.tmx about these addresses? anyways, moving stuff around does help, but i was wondering what was going on or did I do something wrong? what i suspect is going on is that there's an extra ".." in the layer imports, and I don't know what "old/tilesets" is since we already have "code/Tilesets" which serves the information needed. to those who encounter this problem, my solution was to move graphics to the base level of the project, and I created a folder called "old" (again, base of the project) with the tilesets folder copied from code. thanks in advance.
@@ClearCode ha, 40 minutes from my comment! you'd think I'm the one giving you a paycheck to get such a fast response. your effort and work ethic is very much appreciated, brother.
i'm getting an index error: list index out of range . which is at # general setup section self.image = self.animations[self.status][self.frame_index] in player py file. ive looked over the project file from github to see if my code was wrong and maybe i missed something in the video. well after re-reading through the comments and stumbled across someone that had the same issue well i found that "../graphic/character" was my issue the double period was going back to far in the folder structure removed one period and now everything works. Love the tutorial so far and solving my "bugs"
Hi Clear Code if you could could you all so make a small tutorial or atleast help me tell me why i cant like go upp one folder ../graphics/fruit/apple.png or anything else that is like a example beacause i need to like write the entire path from my c:/users thing?? also im using Visual Studio Code Otherwise epic tutorial thx alot!!!!!
VScode assumes that the folder you open is the folder you execute your code from, which in your case at the moment is likely the project folder, and not the code folder. Close VScode and open only the code folder with VScode, or you can go into settings and create a launch file that says code needs to be executed from the file location. Someone in my discord made such a file if that works better for you (it's just a few lines of code)
This is a stupid question; but wouldn't it be more convenient to make your own "game engine" with Python and then make games in a more visual sort of way? IDK, I'm much more of a visual person so making something from scratch through code makes my head hurts xD instead of using a premade Game Engine x) Someone smart said once that through experience on developing, you create tools to make programming time much more faster and efficient
I've learned more theory and code patterns from your videos than in years of studying textbooks. Thank you so much for your excellent content!
hey, thank you so much! And super happy to hear that the videos are helpful :)
what have you been reading? html for dummies?
Dude seriously, THANK YOU. The fact that you put in all this work to teach us this stuff is amazing. Just goes to show how much you care. I'll support anything you make!
Can we like the video 3 thousand times in a row? Dude, I work with written documentation, and I know the amount of fucking work that goes into explaining every single little detail. I've done a couple of explanatory videos before. Nothing comes close to the level of detail and the dedication that you put into your videos. They're very helpful! Thank you very much for putting up this kind of content! It's a blessing for people learning Python and game development in general!
You are the BEST! I can't imagine how much effort you put into this tutorial.
Thank you!
Thank you so much for all the time and effort you must have put in making and preparing this video!!
It was not only helpful in getting to understand pygame, but also more generally how to organize the code with classes. Many thanks, job very well done! :-)
Thank you so much and glad it helped :)
This tutorial is very high quality!! Got to appreciate your work!
Thank you so much! :)
for those who run into an issue with pygame and mp3 files: from my short dive into it, apparently mp3 is really finnicky on pygame, and some combinations of app versions and OS lead to pygame unable to load mp3s; this was true for my Windows 10 and latest versions of all software. the solution is either skip the mp3s or use/convert to the recommended ogg or wav format (wav didn't cause me no issues).
If you enjoy this video check out my course: www.udemy.com/course/learn-python-by-making-games/?referralCode=A80FECE8C76096E01111
and my Patreon: patreon.com/clearcode
can u upload dis game on playstore?
(android)
can you post the raw code so I can just copy and paste it into python so i dont waste time please:D
Wow, I just finished your Zeldalike tutorial and was thinking it would be easy enough to try making this exact concept, you sure work fast. Looking forward to checking this out in detail as well. Thank you for providing these!
Well… isn’t this just a delight.
Thank you so much for these tutorials, they have helped me tremendously.
Hey, thank you so much! You have no idea how helpful that is.
Really glad you like the videos so much :)
@Clear Code Your videos are veeery helpful, also bought your course😀
Love these game tutorials but how to protect pygames and e.g. sell them? Compiling them to exe or multiplatform. What would be the best distribution posibilities? Perhaps a nice idea for a video:)
Wow not many replies
Really appreciate the fact that you're making all this for FREE. BTW, your paid Udemy course is very good for the price! Keep up the good work, you're a great YTber!
Finished this tutorial today.
Just want to say thank you for a great video. Really learnt a lot of really neat tricks, and I think you have cleared up some of my confusion regarding object interactivity and importing.
Great video...
Currently working through your paid course and now I'm excited to finish that to then start on this tutorial. Thanks for the amazing content.
It's like a mix of Stardew Valley and Littlewood. Great job!
At 46m09s, for the mechanism to make the frames repeat, instead of using an "if statement" you could use a module operator (%). It is faster (since it wouldn't need to do comparisons all the time) and cleaner (onli one small line of code)
Short Example:
frame = (frame+dt*4)%len_anim
I noticed this as well.
Can't wait to start this. The other tutorials have given me confidence just to start and this just looks so much more expansive!
Just completed the tutorial - took me about 16 hours total. Wow! Can't believe something like this is free. Learnt a lot and was really fun to learn something new and see/play the final finished game.
Would love to see videos on the following types of games uisng pygame:
- card game: yu-gi-oh style
- pokemon style game - in particular aspects of changing maps, saving files and the turn based battle styles.
- A game which utilies random map generation to build worlds for a top down game
- A game which has dynamic world - I guess similar to this tutorial but with animals having behaviours that can interact with one another without player input.
I will be going through your Zelda tutorials and Mario Maker ones too. Keep up the good work.
Thanks !
hi what IDE did you use? im using pycharm and i dont know why it keeps on saying “video not initialized” and “Game” has no attribute “clock”” even i typed the same thing as Clear Code does. ive been having the same problem from my first code but i dont know why this errors keeps on popping up for me. 3:31 and a lot of errors happening already :((
i finished the pygame introduction video by him but idk why im having this kind of problem :((( i would be happy to have help since im presenting this as my final project
Hi, I used VS code. I haven’t used APY charm before.
I’m terms of where you are getting stuck. Don’t worry. I also encountered MANY bugs that I had to overcome - I will say 99% were small typos and other bugs.
Potentially start again (as you’re not far into it) and try to write everything from scratch.
OR re-download the starting folder and then remove anything which got added before folder was pushed to the repo.
@@lindenhamer4766 hello, thank you for replying. im starting all over again :)) still stuck though which sucks hahaha
oop! update! got it now! :))
These videos are awesome. Please never stop.
I'm so glad I wantch your videos! It helps me a lot for my final project
Amazing! A lot of effort you put into this tutorial
Thanks mate!
Thanks for the great tutorials, superb quality!
Thank you so much for the support :)
The youtube algorithm threw this at me randomly... 3 hours in and loving it! Thanks for all the effort!
Your course in Udemy is fantastic, I bump into in your channel and after saw your tutorials I just needed to got the course, congratulations.
This is awesome!! Your videos inspired me to further my education. For that you have earnt my money sadly I don't have any yet but when I do I wont forget you ClearCode! Thanks again
it is really nice, I really can't understand how people can create so nice games and so nice videos! You are the best
Thanks you for this great video !
I'm at 32:30 and just in case there's too much animations you can use os module to check for any folder name to create the keys for the assets dictionnary.
By using dictionnary comprehension you can also fill it and if you add or remove animations the process work by itself ! 😊
This guy deserves much more subscribers!
Thank you buddy for all the effort and knowledge you share !!
Thanks so much for this tutorial! I always thought making a game like this would be really difficult, but you've shown me how achievable it is.
You might want to load stum_surf and apple_surf in the level module, and then pass them as arguments inside the Tree class, so you won't call the pygame.image.load function for every tree that has been created and you might gain a lil amount of memory and speed :)
I Love this type of videos! But I have a good idea for the next… can you try to make a game like this BUT with online multiplayer? It would be amazing but keep the work up I like it!
this channel is insane, hats off dude!
ANOTHER GAME YESSSS I LOVE YOU your tutorials helped me so much !!
Amazing! These videos are really helpful for learning python
It 100% works now 🎉 was really fun making this. Definitely considering getting the premium assets to really bring this game to have more life
Great tutorial! Finished it in 3 days. Excellent
At 1:45:12 I used the following shorter and faster code to display the sprites. The idea is to sort the sprites by layer, then display. This eliminates the outer for loop as well as the need to use LAYERS dictionary.
for sprite in sorted(self.sprites(), key=lambda x: x.z):
self.display_surface.blit(sprite.image, sprite.rect)
Later in the video at 2:17:05, the video shows how to add the sprite's y-position to further control the display order of sprites on the same layer, whidh would seem to require the original nested for loop after all. However, I incorporated the change into the above for loop as follows, keeping it a single loop. (Note that this includes the offset logic for the camera motion which the video added in the meantime):
for sprite in sorted(self.sprites(), key=lambda sprite: sprite.z * 10000 + sprite.rect.centery):
offset_rect = sprite.rect.copy()
offset_rect.center -= self.offset
self.display_surface.blit(sprite.image, offset_rect)
The idea here is to create an integer key formatted as zzyyyy where zz is the layer number (the z attribute of the sprite), and yyyy is the y-position of the sprite. Now the sprites are sorted by z (the layer) and then by their y-location, drawing sprites in order from top to bottom, resulting in lower sprites appearing in front of higher sprites on the same layer.
By the way, ditto to all the other compliments that others have made for this excellent video lesson!!
In Python, you can gracefully sort by multiple things using tuples!
sorted(sprites, key=lambda sprite: (sprite.z, sprite.y))
This sorts first by earlier items in the tuple, then by later items. No need to assume y < 1000, or do any math. Hope this helps
@@pianoplayer1262 Right. Why didn't I think of that. Thanks.
@@pianoplayer1262 Do you have any idea how to make the sprites sort properly. Currently his rabit still appears infront of a flower for example when hes halfway up the stem instead of switching behind it when his feet pass the base of the stem. Its really offputting and i tried to sort based on midbottom of the rect but that had no effect
For those who are struggling with walk() function: you probably missed slash or smth. pathlib library is more comfortable to debug so you may want to discover it
I really enjoy your content for the last year or so that I've been learning python! I did buy your Udemy course too, can't wait to dig into that.
I agree
just me casually watching until "it will EASILY be 20 hours long"
proceed to see video length
The quality of your videos is amazing.
hey clear code you should only make the amazing game on this channel you are awesome
is anyone getting a strange bug where when you run the code the first time, everything runs smoothly. But all subsequent runs, certain assets dont load in, specifically the apple sprites and particle effects. Only after saving a bunch does the issue resolve itself for one more run, then it repeats. It almost feels like certain chunks of code isnt running at all. Even when i run the code downloaded straight from the tute, its the same issue. I cant for the life of me figure out wats going on
I think the issue comes from using the groups() method. Try passing the self.all_sprites group into the Tree instance in the level so that you can access it in the Tree class. Instead of calling the group() method, use the all_sprites group. For some reason pygame doesn't keep the groups in the same order every time you start the game. This ensures that the apples are in the all_sprites group every time and should fix your issue
Same thing for the particles, instead of using the groups() method just use self.all_sprites
same problem here, solved it by changing the group index from 0 to 1 in create_fruit function groups = [self.apple_sprites, self.groups()[1]]
@@kinuseo16163 hours into debugging the very same issue and this solution absolutely worked. You're a gentleman.
@@kinuseo1616 Omg, thank u so much, it worked!
Clear Code your videos are awesome, they helped me so much, my request, if you would like to, then please create a video on how to solve problems, implement them in code. Thank You!
I don't even see this kind of master tutorial 🤩 well done brother
Thank you so much!! Going to start right after I finish the Zelda tutorial :D
Totally awesome guide, thanks for your work!
He make 6 hours gamedev tutorial, amazing
I love the tutorials and they really help. Like a lot. Could you please make a tutorial teaching us how to code a pinball game in pygame?
I wanna make it but in Unity or Godot
The art is too cute to resist💖💖💖 Hopefully the video will help from a logical point of view and I'll find out about syntax later 😊😊😄
There's a good course on udemy about making Stardew Valley clone in unity.
Now this is beautiful. Thank you!
At 35:45 after running the code it can't seem to print anything. However no error occurred. Any help please??
This means that the walk() function couldn't find the folder, which probably means that you misspelt the file name, or you code editor is running your code from a different location from your python file. If you're using VS Code, open the 'code' folder and run you game from there. You'll have to view you other files from file explorer, but I haven't found a better solution yet.
@@Noob_-fq7fw thanks!
@@Noob_-fq7fw Where is the 'code' folder? and how we can do that
I have the dumb, your GitHub has the right files. Thank you.
it looks similar to the game named littlewood so thats pretty cool.
Gives me hope when my coding background is GIS and R
OMG! You are my hero!!!! LOVE THIS!
Thanks a lot for this Contents .. Its really helping me a ton.
awesome. find some time to teach us backend development with python too. you are so good.
In the "Working on the trees" part, when I use the ax to hit the tree, the "tool use" keeps repeating several times, as if I were holding the space, so when I touch the tree it breaks automatically. Can someone help me?
Hello how are you? I'm Brazilian, I'm using google translator to send this message, so the sixtaxe and verbal agreement can be very bad... I would like to thank you for all your teachings, you are an excellent teacher... As a video suggestion , it would be very interesting if you made a tutorial where you create a game using the Box2D library.
Unbelievable man! God bless you!
Awesome tutorial dude!
Man you're the best
you have earned yourself a subscriber
Thank you for your work!! it is very easy to learn with your explanation, is it possible to build a multiplayer with the base of this code?☺
I'll try my best to watch this and follow along, even though I have only about two hours after work before I should go to sleep:
Day 1: 00:00 - 7:09 (an hour of progress, most of the time spend on learning about delta time)
Day 2: 7:09 - 31:35 (an hour of progress, ate a bit also)
Day 3: 31:35 - 48:32 (an hour of progress, was a bit stuck at one point but prevailed)
Day 4: 48:32 - 1:09:05 (forty minutes of progress, was just tired idk)
Day5: 1:09:05 - 2:03:38 (a couple hours of progress, was my day off!)
Day 6: 2:03:38 - 2:03:38 (0 progress, hadn't any time unfortunately)
Day 7: 2:03:38 - 2:03:38 (0 progress, hadn't any time unfortunately)
Day 8: 2:03:38 - 2:03:38 (0 progress, hadn't any time unfortunately)
Day 9: 2:03:38 - 2:03:38 (0 progress, hadn't any time unfortunately)
Day 10: 2:03:38 - 2:33:46 (an hour of progress, my god it was intense, I don't understand almost nothing at this point, feels like black magic)
hey about the part at 21:45 with storing floats in rects issue and the need to store it in self.pos, pygame-ce comes with 'FRECTS' that can store float values
0:33 what is that software i searched for that so long also i like your videos.
It's called Tiled, I made a whole tutorial on it: ua-cam.com/video/N6xqCwblyiw/v-deo.html
@@ClearCode thanks
In the recent version of pygame (pygame 2.5.2 (SDL 2.28.2, Python 3.12.2)), it seems that the order of groups is not kept as is (but nor everytime). I added "self.group0 = groups[0] if isinstance(groups, list) else groups" before the call to super in the Generic class and replaced all the self.groups()[0] by self.group0 to get around this problem...
what ide do you use?
i ifnd the solution to error "list out of range" on vs code
you have to "for animation in self.animations.keys():
full_path = './graphics/character/' + animation
self.animations[animation] = import_folder(full_path)"
instead of
'../graphics/character/'
thanks, was looking for this!
I think we missed delta time in the grow() method of Plant!
Amazing work!!
Why does it not show apples and particles after I run the python, one out of three times. I've tried deleting cache, changing IDE. When I opened his project s12 Particles. It also often times did not show any apples or particles on the screen. Any idea what's going on?
even when there is 10 out of 10 chance for apple to spawn
Completed the whole tutorial! It was fantastic. But that issue still persists. Sometimes there is no particles or apples. Like one out of 3 times
did you figure out a fix to this?? running into this issue as well. @@vadvenurt
per a comment below, what i did:
[sprites.py]
class Tree(Generic):
def __init__(self, pos, surf, groups, all_sprites, name): # add all_sprites
# apples:
self.create_fruit(all_sprites) # pass all_sprites here
def create_fruit(self, all_sprites): # add all_sprites parameter
Generic(
pos=(x, y),
surf=self.apple_surf,
groups=[self.apple_sprites, all_sprites], # use all_sprites directly
[levels.py]
def __init__(self):
self.setup(all_sprites=self.all_sprites) # pass all_sprites here
def setup(self, all_sprites): # add all_sprites parameter
# trees
for obj in tmx_data.get_layer_by_name('Trees'):
Tree((obj.x, obj.y), obj.image, [self.all_sprites, self.collision_sprites, self.tree_sprites], all_sprites, obj.name) # add all_sprites parameter
This worked for the fruit but not the particles any idea how to add it there as well
Great tutorial. Very helpful.
In main.py in line 20 (about 6:29 into the video), I would expect a statement like:
dt = pygame.time.get_ticks() / 1000
The line as it is currently seen in the video does not seem to work on my machine...
Great tutorial better than the coding I learnt at university
Thank you so much for your tutorials!
@ClearCode Hi sorry To ask again but i was wondering could you maybe like add a pt 2 of this tutorial it would be helpful where i can at least add a tutorial, play screen with settings and even a pause menu with save game and stuff like that because i am not good in pygame but love the tutorials and i would like to do more and make it my first completed game thx.
He i have the same Problem with the Apple that they are not drawing after the trees. Its something withe the pygame groups.
def create_fruit(self):
for pos in self.apple_pos:
if randint(0, 10) < 2:
x = pos[0] + self.rect.left
y = pos[1] + self.rect.top
Generic((x, y), self.apple_surf,[self.apple_sprites, self.groups()[0]], LAYERS['fruit'])
the thing with the self.groups()[0] dosnt work :(
can someone help me?
I’m having this same problem
Can you make a video on how to make an MSM fan-game in unity? i wanna be like rz (Raw Zebra) but you probably don't know what MSM is, so i recommend you get an understanding on what MSM (My Singing Monsters) is
thanks. if not, that's ok.
A Tutorial that leads to a bunch of tutorials. Really cool
This is such a nice game!!
Timestamps Correction:
Sound starts at 6:34:45 not 6:23:46
You re just amazing!
Great tutorial! I've just completed the tool use section, and found that all of the animations play in reverse. Even downloading your code and running that does the same. Swapping the names of the animation files go from 1 to 0 works, but I'm wondering why it would do that in the first place? I can't find any reason it would do this especially if your code also plays in reverse as well. Any ideas?
woah, 6 hours? this must be good. i'll try to edit this comment when i finish :D
You're a good teacher, tnx a loot!!! 👏
Clear Code You should do Factorio game in pygame
For loccision hitbox why did u separate to self.hitbox.centerx and self.hitbox.cerntery instead of using self.hitbox.center = self.rect.center? I think it is cleaner.
Later on you need to separate the dimensions to make the collision mechanic work
@@ClearCode i think i am that part just now. BTW GG great and deep tutorial video. Also i just noticed my horible spelling above. :D
hello, thank you for this tutorial and many other that have helped me improve a lot.
at the part where I'm importing the tiled data into the loop, if I copy your exact code I get the error: "Cannot find tileset file ../../old/tilesets/Hills.tsx from ../data/map.tmx, should be at (my info)\old\tilesets\Hills.tsx", where it seems to refer to a directory called "old" which doesn't exist in your project files. after that I had to move the graphics file as well according to where the console wanted them to be, which was base project level. I assume Tiled has built-in info into the map.tmx about these addresses? anyways, moving stuff around does help, but i was wondering what was going on or did I do something wrong? what i suspect is going on is that there's an extra ".." in the layer imports, and I don't know what "old/tilesets" is since we already have "code/Tilesets" which serves the information needed. to those who encounter this problem, my solution was to move graphics to the base level of the project, and I created a folder called "old" (again, base of the project) with the tilesets folder copied from code.
thanks in advance.
Hey, something went wrong with the files in Tiled, I fixed it and the files on github are updated now :)
@@ClearCode ha, 40 minutes from my comment! you'd think I'm the one giving you a paycheck to get such a fast response.
your effort and work ethic is very much appreciated, brother.
i'm getting an index error: list index out of range . which is at # general setup section self.image = self.animations[self.status][self.frame_index] in player py file. ive looked over the project file from github to see if my code was wrong and maybe i missed something in the video.
well after re-reading through the comments and stumbled across someone that had the same issue well i found that "../graphic/character" was my issue the double period was going back to far in the folder structure removed one period and now everything works. Love the tutorial so far and solving my "bugs"
Really helpful.
Hi Christian! Love your tutorials. Could you provide a version of the starter code and assets that isn't .rar, but a .zip? My mac is being fussy...
I'm confused as to when to use topleft and center position, you use them interchangeably.
Hi Clear Code if you could could you all so make a small tutorial or atleast help me tell me why i cant like go upp one folder ../graphics/fruit/apple.png or anything else that is like a example beacause i need to like write the entire path from my c:/users thing?? also im using Visual Studio Code Otherwise epic tutorial thx alot!!!!!
VScode assumes that the folder you open is the folder you execute your code from, which in your case at the moment is likely the project folder, and not the code folder. Close VScode and open only the code folder with VScode, or you can go into settings and create a launch file that says code needs to be executed from the file location. Someone in my discord made such a file if that works better for you (it's just a few lines of code)
Thanks will definetly try i just finished tutorial and i LOVE IT THXXXXXX@@ClearCode
@@ClearCode OMWORD IT WORKED THXXXXXXXXXXX XOXOXOXOXOXO
great job
This is a stupid question; but wouldn't it be more convenient to make your own "game engine" with Python and then make games in a more visual sort of way?
IDK, I'm much more of a visual person so making something from scratch through code makes my head hurts xD instead of using a premade Game Engine x)
Someone smart said once that through experience on developing, you create tools to make programming time much more faster and efficient
why the git hub code does not run?
Wowww, this is amarzing !!!