Hey there, thanks for the useful additions again! Let me share my thoughts: 👉🏻 The best way to use the .get method of dictionaries is the one you just mentioned - seems like I slipped over this simplification when making the video. 👉🏻 Wrapping the game in a run function is a nice way to handle it. I usually create a Game class for this and call it from the main.py that serves as the entry point of the project. And with this, you won another pin 🤙🏻
@Klannahar2 ай бұрын
Damn i just pointed out the same as u, and realized the very first comment say the same. XD U saved me a few sec of my life, and then i just type even more here. XD
@user-vc7bs8dp2jdhj Жыл бұрын
criminally underrated video
@orkslayergamedev Жыл бұрын
Thank you, it really means a lot to me! 🙏🏻
@sayanbiswas779611 ай бұрын
You are goddam right KZbin algorithmic really gone potato mode with this one video quality is godly
@obedience764111 ай бұрын
You are 100% correct. It’s nice to see a developer showing love to another developer instead of looking for faults and being so petty. There’s never just 1 way to do a thing. ABSOLUTELY underrated!!!
@kenjii962610 ай бұрын
holy sht, best OOP tutorial . Glad youtube recommended you 😁
@orkslayergamedev10 ай бұрын
And I'm glad that you're here! Thanks a lot for the kind words, I appreciate it! 😊
@fieryelf9 ай бұрын
I've been learning Python for the past month and this is easily the best tutorial for Classes I've seen so far.
@orkslayergamedev9 ай бұрын
Thank you for sharing your thoughts, I really appreciate it! I'm so glad that many people are enjoying my tutorial 🙏🏻
@danielhegyi503710 ай бұрын
Your video is the perfect proof that when you're looking for a good tutorial video you shouldn't always care about the views on it, because there's might be a hidden gem like this. Thanks for the upload!
@orkslayergamedev10 ай бұрын
Thanks a bunch for the kind comment, I really appreciate it! I'm still grateful for my handful of views and will continue to upload cool content for my audience 🙏🏻 Cheers from Hungary! 👋🏻
@weshen8310 ай бұрын
I have watched a lot of beginner programming tutorials, and haven't been busy with it for two years. And then this video gets recommended that teaches me concepts that just wouldn't "click". Thank you so much for creating this video, and keep it going. You deserve a lot more views and subscribers, just keep going and you probably get notices by the algorithm.
@orkslayergamedev10 ай бұрын
Thanks so much for the great feedback, I really appreciate it 🙏🏻 I'm really happy that my video helped you with your programming journey! Feel free to drop any question in the future if you need help 👋🏻
@bow_wow_wow11 ай бұрын
Ah! You know so many Python features. It disturbs me a little bit when some big time KZbinrs seem unaware of these things. Thank you!
@orkslayergamedev11 ай бұрын
Thank you for the kind words, it sure feels great to have a wider knowledge in Python! I try to represent as many of the little tricks as I can 🙏🏻
@jennytaylor3986Ай бұрын
Had a friend try to explain classes to me yesterday by translating some messy nested if/elif/else code I'd made into classes and telling me what he was doing. I could NOT grasp it. Doing this alongside the video, but using different terms in the flavor of the game I'm making made me understand a LOT better. Thanks!
@orkslayergamedev12 күн бұрын
I'm really glad to hear this! Mixing learning with playing (or eventually creating a game) makes it so much easier, I'm glad it worked for you too! Thanks for the feedback :)
@samanthapennington42325 ай бұрын
I have been teaching classes for a couple of weeks and this is one of the best examples I've seen. I will be getting all my seniors to make this in the coming week.
@orkslayergamedev5 ай бұрын
Such an honor, thank you for sharing this with me! 🙏 If you want to make it more fun/interactive for your seniors, you could show them the second part of this video as well (my latest one), as I've included 5 coding challenges along the way! They could even compete in a friendly manner with the points they gathered :)
@sh_4016 Жыл бұрын
Finally i understand classes in python after 3 years thanks Also I love the new style of your video, this time it actually fits perfect
@orkslayergamedev Жыл бұрын
Wow, I'm really happy to hear this! I struggled with classes for a long time and I wanted to make a video with clear explanation. Thanks a lot for the feedback, I'm glad you like the editing too :)
@corveux5143 Жыл бұрын
Absolutely best explanation of OOP for Python I have come accross (maybe its just because I understand it better in gaming terms), thank you so much for this!
@orkslayergamedev Жыл бұрын
Hey, thanks a lot for the feedback, I really appreciate it! 🙏🏻 I wanted to create such a tutorial that if I watched it years ago, I understood classes much faster 😁 Based on the comments, I achieved this goal, so I'm really happy!
@deadspace25958 ай бұрын
I think this is about as simple explanation as one can get for this. I still don't understand the classes fully, but this video definitely helped a lot. I just wish you were talking slower and explaining things more as you do them cuz ngl I got lost A LOT watching this.
@orkslayergamedev8 ай бұрын
I learned it the hard way unfortunately so I wanted to share my knowledge the most fun way possible! Thanks for the feedback and sorry if the pace was too fast, it's hard to find the right one most of the time 😓 Let me know if you have Python related questions along your learning journey! 🐍
@zd4w98 ай бұрын
This video really helped me understand to the point where I could go back and find my mistakes on my own. Thanks a lot!!
@orkslayergamedev8 ай бұрын
I'm glad my video was helpful to you! Good luck with coding! 🐍
@shi71968 ай бұрын
Making a complicated subject easy to understand and fun while at it is incredible.
@orkslayergamedev8 ай бұрын
I'm glad you had fun with the video, happy coding to you! 🐍
@bernardseno25359 ай бұрын
This video deserves a million views and you Sir deserve a million subscribers. Thanks to your video I was able to understand Python's OOP and this is coming from a person who's third language is English. Your video presentation together with your explanation made this complex topic easy to understand. Subscribed.
@orkslayergamedev9 ай бұрын
Wow, such kind and encouraging words! Thank you so much for the support, it truly means a lot to me! I'm glad the video helped you on your programming journey and I hope to see you around the channel 🙏🏻
@lucaslima77596 ай бұрын
If you don't learn about classes with this video, just forget about it 😂. Cleanest video about classes that I ever watched
@orkslayergamedev6 ай бұрын
Haha, right - game concepts with visual representation can be understood so much better! Thanks a lot for the amazing feedback, happy coding to you 🙏🏻🙌🏻
@ddkrscovers41637 ай бұрын
Köszi a segítséget! Mindig újra és újra belekezdtek a Python programozásba, de mindig megakadok amikor jön egy nehezebb feladat és a végén feladom. Remélhetőleg ezúttal sikerül megtartani a motivációt. Eddig nagyon tetszik a channel, remélem lesznek még videók. Könnyen érthető a magyar akcentussal. :DD Az elején fogalmam sem volt hogy magyar vagy, aztan a videó felénél klikkelt az agyam.
@orkslayergamedev6 ай бұрын
Szívesen! 😊 Ne aggódj, gyakran futunk falakba, ami elég gyorsan alá tudja ásni a tanulás iránti elkötelezettségünket. 5 év tapasztalattal sincs ez máshogy - ilyenkor egy lépés hátra és meg kell próbálni vagy máshonnan megközelíteni a problémát, vagy esetleg kisebb lépésekben haladni. Őszintén örülök, hogy rám találtál és hogy tetszik a csatorna! Lassan, de biztosan érkeznek az új tartalmak :) Addig pedig keress bátran bármilyen kérdéssel, igyekszem figyelni a kommenteket minél gyakrabban. Sok sikert a Pythonhoz! 🙌🐍
@KoalaFruittoo4 ай бұрын
You are very good at being able to explain things in a way that is understandable; Love this video!
@orkslayergamedev12 күн бұрын
Thank you so much for the kind words! I'm happy to hear this 😊
@Joaopedro-kp9mu11 ай бұрын
this video is so underrated for what it delivers.
@orkslayergamedev11 ай бұрын
I really appreciate your words, thank you so much! 🙏🏻
@sirknumbskull341811 ай бұрын
You nailed it! I am interested in the Code Patterns. It is hard to find a tutorial, that shows you how to construct that whole thing WITH PURPOSE! Most tutorials just type a code and you habv no Idea about the WHY that and NOT that? So you filled a gap here! Thanks!
@orkslayergamedev11 ай бұрын
Hey there, thanks a bunch for your awesome feedback! I always try to deliver meaningful content with context, answering all possible questions in-the-go. So I'm really happy that you discovered this video and that it lived up to your expectations! I love design patterns too, it's fun to construct the code in different ways to reach the best efficiency. Happy coding! 🚀💻
@Blackronin3576 ай бұрын
I learned alot from this video about classes and being able to put it together in visual manner really helps students like us grasp it better.
@orkslayergamedev6 ай бұрын
Thank you so much for the valuable feedback, I really appreciate it! 🙏🏻
@bernardogeocometto55629 ай бұрын
Super useful, just started programming, and OOP is amazing because it makes everything more flexible. The video and the examples are awesome also. It gave me ideia to make of on my own, like a spaceship project.
@orkslayergamedev9 ай бұрын
Thanks a lot for the amazing feedback, I really appreciate it! That spaceship project you mentioned sounds epic, feel free to share it with me anytime if you make it public! 🚀
@nike-1683 Жыл бұрын
Hooray! Thank you very much for the new video!
@orkslayergamedev Жыл бұрын
And thanks a lot to you for the feedback! I'm happy you enjoyed the content 😊
@boredgamesph48729 ай бұрын
Looking forward for the next chapter for this like adding RNG (Critical, dodge, block). Thanks for this kind of lesson.
@orkslayergamedev9 ай бұрын
Thank you, much appreciated! I hope to create more content like this as it's huge help to lots of people. If you have any suggestions or requests regarding topics you would like to see on the channel, feel free to share them with me anytime!
@boredgamesph48729 ай бұрын
@@orkslayergamedev Please create tutorial on how to make game with RNG with programming.
@orkslayergamedev9 ай бұрын
Alright! I'll add it to the topic poll and see if people like the idea!
@jiggyjigs50746 ай бұрын
one of the best if not the best video to teach people about classes 👍👍👍
@orkslayergamedev6 ай бұрын
I appreciate your kind words, thank you! 🙏
@switbitz7 ай бұрын
I love how you implemented game development in a python oop tutorial.
@orkslayergamedev7 ай бұрын
Thanks a lot! My aim is to make coding fun! 🐍
@t.t.cooperphd538911 ай бұрын
what an awesome tutorial on OPP. well done.
@orkslayergamedev11 ай бұрын
Thank you very much for the feedback, much appreciated! 🙏🏻
@blueslimed4 ай бұрын
very effective summary of oop programming
@orkslayergamedev12 күн бұрын
Thanks for the feedback, really appreciated! 🙏
@igibomba10 ай бұрын
Just started with OOP and this video bangs 🤘. Quality upload, will subscribe for more.
@orkslayergamedev10 ай бұрын
I appreciate your support, thank you so much! 🙏🏻
@thomaskottke61127 ай бұрын
Nice video, I appreciate you example was more realistic than a lot of other class tutorials I have seen.
@orkslayergamedev7 ай бұрын
Thank you! I’m happy to hear you found the video useful! 🙌 Stay tuned for more! 🐍
@Ameyiscool6 ай бұрын
Hello orky, this video is awesome. Would like if you create these type of vdos on other topics of python like variables, decorators, loops and many more and a bonus project based on them. This would definitely help your channel reach a bigger audience as well. Hope you read this and think about it. Thanks man!
@orkslayergamedev6 ай бұрын
Hey! Thanks a bunch for the helpful feedback 🙌🏻 I'm aware that similar videos would reach bigger audience, so I'm slowly trying to incorporate such ideas! Thanks again for your thoughts 🙏🏻
@alanharyaki48909 ай бұрын
The best python tutorial video I've ever watched. Hope I had watched it earlier.
@orkslayergamedev9 ай бұрын
Thank you very much for the kind comment, I appreciate it!
@joekhames41617 ай бұрын
Woooow I am 5 min in and it's amazing how it makes sense and easy it's to understand, keep up the good work ❤
@orkslayergamedev7 ай бұрын
Thank you so much! ❤ I'm happy to hear it's helping you out. Keep your eyes open as there's more to come soon! 🙌🐍
@mariuszowczarek1875 Жыл бұрын
Thank You. Great Example and easy to understand !👍
@orkslayergamedev Жыл бұрын
Thank you for the feedback, I greatly appreciate it! 🙌🏻
@PabloSanDev8 ай бұрын
Thank you for this great tutorial, i'm very happy with it.. this game logic, architecture is exactly what i wanted to learn i followed along by using C# to challenge myself amazing again tysm.
@orkslayergamedev8 ай бұрын
Wow, that was surely a great challenge, good job! I appreciate your feedback and thanks for joining us! 🙌🏻
@william-WBG11 ай бұрын
EXCELENT TUTORIAL I DIDNT KNOW THAT I COULD CHANGE THE COLOR OF MY TEXT LIKE THAT!
@orkslayergamedev11 ай бұрын
Thank you very much for the feedback! Coloring console text adds so much to any project/game, have fun using it 🙌🏻
@none32429 ай бұрын
Okay ! this video is much better that others which has million of views , such a gem you are edit: and you got a sub ~~
@orkslayergamedev9 ай бұрын
I really appreciate your kind words, thank you so much! 🙏🏻 Welcome aboard! 🐍
@evil_in_your_closet8 ай бұрын
Very cool! Its quick, concise and clear! Instant Subscribe!
@orkslayergamedev8 ай бұрын
Thanks for joining us, I appreciate it! Have fun coding! 🐍
@MineGamerIL Жыл бұрын
Your channel is an absolute bliss ! , So glad I stumbled upon you .. Cheers !
@orkslayergamedev Жыл бұрын
Wow, you're so kind! Thanks for joining us, I'm glad to have you here 🙏🏻❤️
@djciregethigher7 ай бұрын
Wow!! Thank you. That was a quick, concise, and extremely educational demonstration of OOP! Cheers!!
@orkslayergamedev7 ай бұрын
I'm glad you found it educational and helpful - part 2 coming soon! Until then, happy coding! 🙌🐍
@bennyuchiha850110 ай бұрын
Wow, I did now know how much I needed this
@orkslayergamedev10 ай бұрын
I'm glad you found it useful! Have fun with your new knowledge 🙌🏻
@knut-olaihelgesen3608 Жыл бұрын
The naming convention for class names is called Pascal case. It takes the form of MyCoolClass, while Camal case takes the form myCoolClass (lower case starting letter). Use Pascal case!
@orkslayergamedev Жыл бұрын
I know that PascalCase exists, although there's some misconception on the web about camelcase actually being camelCase or CamelCase. We even had a debate with my co-workers. Although camelCase would make more sense, so you're most probably right!
@lexelis957110 ай бұрын
I'm actually working on a text-based adventure game, and this is exactly what I need! :D Already got most of what you've shown, but it's much better written and you expand upon things I couldn't have done
@orkslayergamedev10 ай бұрын
Hey! I'm glad you found the video helpful, I appreciate your feedback! Good luck with your game and feel free to drop any questions if you need help 😊
@lexelis957110 ай бұрын
@@orkslayergamedev Hi thank you! I might need some advice sometimes if I get stuck. How would be the most convenient way for reaching out?
@orkslayergamedev10 ай бұрын
Well, I check the youtube comments daily and if there's a question, I respond asap (yet yt studio only shows new comments and not answers unfortunately) You can also contact me on Ko-fi via direct messages, there I can even send code snippets via screenshots if needed :) Lastly there's my instagram and social email adress, but I check those rarely. You can find all my contacts on my channel page 🙌🏻
@YDV6697 ай бұрын
I just realized after watching this video that history truly cheated us by denying us the existence of a knight in full armour wielding an RPG.
@orkslayergamedev7 ай бұрын
I definitely forgot about that part - thanks for the good laugh! 😂
@NuWerra_OF9 ай бұрын
as a beginner this was a pain in the ass but i learned a lot and honestly this is amazing because i don't think i've could do this if it wasn't for making a game
@orkslayergamedev8 ай бұрын
I struggled with classes long ago as well, I know the feeling! Back when I started using Python I created really simple ASCII games, it's a pretty good way of learning in my opinion :)
@apkaless7 ай бұрын
wow thats the video i were waiting for, thanks man
@orkslayergamedev7 ай бұрын
So glad to hear that! I appreciate your feedback! 🙌
@kevinmaas786710 ай бұрын
its really cool video i will bookmark this for learn again in future
@orkslayergamedev10 ай бұрын
Thanks a lot, hope to see you around the channel soon! 🙏🏻
@padfoot-oz4yk4 ай бұрын
thank you so much brother you have successfully taught me concepts of oops
@orkslayergamedev12 күн бұрын
If anyone asks why creating tutorials worth it, this is it! Thanks for sharing this with me, happy coding to you! 🐍
@cesarjaramillo4057 Жыл бұрын
Excelent content, i hope this channel explode so i can see you guide to recreate dwarf fortress in the future 😊
@orkslayergamedev Жыл бұрын
Thank you so much! 🙏🏻 Let's find that out in the future! With enough time and effort, everything is possible 😁
@kaushalshailbinha736510 ай бұрын
best explanation of class
@orkslayergamedev10 ай бұрын
Thank you, I appreciate it! 🙏🏻
@rida_brahim11 ай бұрын
thanks for the explanation, just wish if it was a little bit slower, but still great way to understand oop more deeper
@orkslayergamedev11 ай бұрын
Thanks a lot for the feedback, I appreciate it! I'm sorry if it turned out to be a little too fast, I always try to set a pace that the tutorial is comprehensible yet fast enough that nobody falls asleep by the end :)
@ZeroSpawn10 ай бұрын
Just watch at 0.5 speed. His voice will change a bit. 😅
@EigenA3 ай бұрын
Absolute legend
@orkslayergamedev12 күн бұрын
Thank you! 💪🏼
@HrafnNordhri10 ай бұрын
First, thanks for this. Second, Which editor is this? I've been using an unregistered copy of Sublime. When I run the code shown at 5:18, I only get one set of values, you seem to get multiples. I tried running it several times in a row and only get the same variables no decrease in their health.
@orkslayergamedev10 ай бұрын
Hey there! I use PyCharm Community Edition but the code should run as expected regardless of the editor you use. The terminal expects an input in each cycle, did you press enter in the console?
@HrafnNordhri10 ай бұрын
@@orkslayergamedev I did and no go.. So I installed pyCharm and worked great. Thanks!
@orkslayergamedev10 ай бұрын
I'm glad that it worked at the end! Have fun using PyCharm, it has lots of cool features that you'll like! 🐍
@ColinTimmins10 ай бұрын
Thank you for this video as It’s really well done. I’m dyslexic, among other things, and been learning to code. Material like this is very appreciated. =]
@orkslayergamedev10 ай бұрын
Thank you for your kind comment, it means a lot! Feel free to leave questions anytime! 🙌🏻 Hope to see you around and good luck with your coding experience! 😊
That's fantastic to hear! 🙌 Thanks for subscribing and happy coding! 🐍
@mecrayavcin5 ай бұрын
Excellent WORK Thanks very much
@orkslayergamedev12 күн бұрын
Thanks for your feedback, I really appreciate it!
@wilsonliu17167 ай бұрын
love it! btw what's theme is this? I like the way of highlighting style
@orkslayergamedev6 ай бұрын
Thank you! 🙌 I recently switched from this one but I believe it was the One Dark Italic style from the One Dark Theme plugin. Here's the link: plugins.jetbrains.com/plugin/11938-one-dark-theme
@aleksanderyevdokimov26408 ай бұрын
Cool project. Thanks for video.
@orkslayergamedev8 ай бұрын
Thank you, I appreciate your feedback!
@tinypopura10 ай бұрын
I'm still in the beginner phase of learning python, but this was very helpful! Classes and definitions are the bane of my existence, but I understand them a little more now thanks to you. Since the game doesn't end after the health bar reaches "0", what would be a good way to implement that into the code? I've added: if self.current_value==0: exit() Which seems to do the trick, but is there another way to do this?
@orkslayergamedev10 ай бұрын
Thanks a lot for the feedback, I'm glad my video helped you with programming! 🙌🏻 Let me assist you with quitting the game! Here's the original main loop of this video: # ------------------------------------------- while True: os.system("cls") hero.attack(enemy) enemy.attack(hero) hero.health_bar.draw() enemy.health_bar.draw() input() # ------------------------------------------- One way of handling the quit event is to break out of the while loop whenever the health of the hero reaches 0: # ------------------------------------------- if hero.health 0 # ------------------------------------------- We can even wrap all this into a Game class to make it nicer: # ------------ game class ------------ class Game: def __init__(self): self.running = True def run(self) -> None: while self.running: os.system("cls") hero.attack(enemy) enemy.attack(hero) hero.health_bar.draw() enemy.health_bar.draw() input() self.running = hero.health > 0 input("GAME OVER") exit() # ------------ game loop ------------ if __name__ == "__main__": game = Game() game.run() # ------------------------------------------- Feel free to copy-paste this into your main.py :) Drop your questions whenever you need more help!
@andrewfrost8866 Жыл бұрын
Excellent and informative!!
@orkslayergamedev Жыл бұрын
Thank you very much! 🙏🏻
@circuithijacker10 ай бұрын
Amazing tutorial!
@orkslayergamedev10 ай бұрын
Thank you very much, I appreciate it! 🙏🏻
@ashbuu59076 ай бұрын
Am I missing anything? I do not understand where you get the greenish color for symbol_remaining. How did you acquire that?
@orkslayergamedev6 ай бұрын
No problem, let me help! This is the part of the string we need to take a look at: f"{self.color if self.is_colored else ''}" f"{remaining_bars * self.symbol_remaining}" f"{lost_bars * self.symbol_lost}" f"{self.colors['default'] if self.is_colored else ''}" It starts with a f"{self.color if self.is_colored else ''}" - this means if the is_colored bool is True, this evaluates to the color string of the of the health bar. Otherwise it's an empty string that does nothing. If the color string is present, all the following text will be colored (literally everywhere) until the code finds another color string that changes this behaviour. As you can see the fourth line here is f"{self.colors['default'] if self.is_colored else ''}" - meaning if we started coloring, we paste the default color here. Which is the one that actually sets the color to the original grey/white. Let me show you the evaluated values: "\033[92m" f"{remaining_bars * self.symbol_remaining}" f"{lost_bars * self.symbol_lost}" "\033[0m" If we paste the symbols too for someone with missing health: "\033[92m" "██████████" "__________" "\033[0m" So the first row starts the coloring. Second row gets colored. Third row gets colored. Fourth row stops coloring. That's it, basically. Let me know if this helped :)
@demonman12348 ай бұрын
I like to think about it like a container of cookies or something.. You got a container which holds cookies Each cookie has their own values (shape, size, flavor, etc) You can inherit it by putting it into another container… and so on. Now this way of thinking about it falls short when it comes to polymorphism, at least in my example.. but oh well.
@orkslayergamedev8 ай бұрын
Interesting concept! You can easily incorporate polymorphism in your idea if you define the classes this way: class Food(ABC): @abstractmethod def eat(self): pass class Cookie(Food): def eat(self): print("You ate a cookie.") class Container(ABC): @abstractmethod def store(self, food): pass class CookieJar(Container, list): def store(self, cookie): self.append(cookie) print("You put a cookie in the jar.")
@demonman12348 ай бұрын
@@orkslayergamedev True, if you include the container itself into the concept and actions performed on it.
@bandedecodeurs11 ай бұрын
Super cool video. Really loved it Well though and well realized. Please, continue ! 🙏🏻
@orkslayergamedev11 ай бұрын
I will for sure! Thank you very much for the feedback, I really appreciate it! 🙏🏻
@x4tra5577 ай бұрын
Hey, I know it's quite an old video but I have a question. It would be really helpful if you would be able to answer! So, Why did you put 'self' everywhere? What does it do? (I know it's a rookie question but I'm just getting into this stuff)
@orkslayergamedev6 ай бұрын
Hey there! No worries at all; there are no rookie questions here. I'm happy to help! The keyword self is used in Python class methods to refer to the instance of the object it"self". Whenever you define a method inside a class, you need to include self as the first parameter so you can access the instance's attributes and other methods. When you use self, you're telling Python which object's data to access or modify (again, the data of the object itself). Furthermore, you could name it anything else, self is just a naming convention. This would work as well... class Hero: def __init__(the_object_itself, name): the_object_itself.name = name But when you actually create an object, you don't need to pass that self-referencing argument... hero = Hero("John") When you want to access the name of the hero object like... hero.name ...what Python does is it looks into the object and searches for self.name (or the_object_itself.name in this case). Hope this helps a bit! Let me know if you have further questions, I'll keep an eye out for your comment! 🐍
@x4tra5576 ай бұрын
You made it so much clearer to understand. Thank you so much!
@muammerbeytekin644611 ай бұрын
Thanks a lot! but i didn't get how to do 10:21, which kind a if statement i need?
@orkslayergamedev11 ай бұрын
Hey there! As you can see in the console output, the hero can drop it's default weapon too (Fists) - which is probably a bug we don't want in our games. The simplest way to resolve this issue is to update the drop method as follows: def drop(self) -> None: if self.weapon != self.default_weapon: print(f"{self.name} dropped the {self.weapon.name}!") self.weapon = self.default_weapon
@muammerbeytekin644611 ай бұрын
Thanks man u are really my favorite Python teacher rn! @@orkslayergamedev
@orkslayergamedev10 ай бұрын
I really appreciate your kind words, thank you so much! I hope that you'll enjoy the upcoming content as well 🙏🏻 (ps. sorry for the late reply, youtube sends no notifications of comment answers)
@SolathPrime10 ай бұрын
- [14:53] I would like if you use: `os.system("cls|clear")` This way if command: `cls` is not defined -like in my linux machine-, it'll fall back to: `clear`
@SolathPrime10 ай бұрын
Also I subscribed from this video and had the bell on so I don't miss any coming uploads ;-)
@orkslayergamedev10 ай бұрын
Hey there! Thanks for the nice addition, I didn't know you can pass "cls|clear" as arguement, cool! And of course I'm happy to welcome you to the channel! 🙌🏻
@SolathPrime10 ай бұрын
@@orkslayergamedev one little correction I need to add use "cls||clear" instead of "cls|clear" as the first ors `cls` with `clear` while the other pipes `cls` to `clear`
@orkslayergamedev10 ай бұрын
Right, thanks for the correction! I'll use this trick later on 👌🏻
@sun_ada4 ай бұрын
Yo thanks for the tutorial !!!!
@orkslayergamedev12 күн бұрын
Sure thing, man! My pleasure!
@Lion85859 ай бұрын
Excellent video, thanks for sharing
@orkslayergamedev8 ай бұрын
Thanks for the feedback! 🙏🏻
@peaceanquiet45289 ай бұрын
Question for hp dmg. Why use the max function to prevent it from going below zero, I'm new and my first thought would be a min.
@orkslayergamedev9 ай бұрын
Thanks for the question! It's totally up to your game logic how you want to handle health, although I like to set all negative values to zero. This way whenever I want to display health bars, I don't need to worry about incorrect negative numbers. If min is confusing to you, take a look at the following: max(health, 0) means the same as if health < 0: health = 0 Let me know if I can help with anything else!
@Charlie-nx9pk9 ай бұрын
Hi there! I just started learning python and using Pycharm IDE. I'm just following the steps as you said but the intellisense is not working when i try to import the Character. Could you please help me with that?
@orkslayergamedev9 ай бұрын
Hey, of course, I'd be happy to help you! PyCharm can be a bit complicated if you just started out whit programming, I also had issues with it when I learned the basics. I'd try the following steps to fix the issue: First of all, give the computer a restart if you haven't done it already. If the problem persists, try to use: from .character import Character instead of from character import Character This way you explicitly import Character from the character module that is in the same directory as the file you call the import from. If the problem persists, it's likely due to improperly configured interpreter and root path. You can fix this by going to File > Settings > Project: [Your Project Name] > Python Interpreter, and selecting the correct interpreter if it's not already selected. Then to configure the root path you can right-click on the project root directory in the Project tool window, select "Mark Directory as," and then choose "Sources Root." Let me know if these steps solved the problem!
@kirthi19429 ай бұрын
This tutorial was so useful :D !
@orkslayergamedev8 ай бұрын
I'm glad you like it, thanks for the feedback! :)
@thelastexpress427010 ай бұрын
f"{self.colors['default'] if self.is_colored else ""}" > This crashes the program each time. After messing around with it a bit it seems the issue is the ['default'] area. It says it can't be a string. I've commented it out and the program will run just without correctly working healthbars. Is there another way to write this?
@orkslayergamedev10 ай бұрын
Hey! I see the problem. If you use f strings with double quotes, all strings inside should be single quoted. Vica-versa. Otherwise your code will yield a SyntaxError. Try this one with 2 single quotes after else: f"{self.colors['default'] if self.is_colored else ''}" Swapping all singles and doubles works as well: f'{self.colors["default"] if self.is_colored else ""}'
@thelastexpress427010 ай бұрын
@@orkslayergamedev sadly even doing that doesn't seem to help. It just really hates that default portion for some reason and switching from single to double quotes doesn't seem to matter. I was able to get it work by using your original code but for the life of me I couldn't see where the error on my part was as I copied it line from line but there must have been a wrong character somewhere.
@orkslayergamedev10 ай бұрын
Don't worry, all of us come across anomalies from time to time, where seemingly everything is 100% corrent, yet we still get an unexpected error. I'm glad you got the code running either way. Let me know if I can help with anything else!
@adenozin10 ай бұрын
great video, thanks !
@orkslayergamedev9 ай бұрын
Thanks a lot for the feedback, I'm glad you enjoyed it!
@shauryagupta36449 ай бұрын
Bro what an insanely helpful tutorial tysmmmm I had a doubt: When defining the methods, what does the "-> None" do at the end?
@orkslayergamedev9 ай бұрын
I'm glad you enjoyed the video! 🙏🏻 When defining functions and methods, you can leave type hints for the arguments and the return value. Let me show examples: def sum_numbers(n1: int, n2: int) -> int: return n1 + n2 Here we say both arguments should be integers, just like the returned number. If you use an IDE (code editor) that has a built-in linter (code checker), it will automatically warn you if you A, define the function/method in a way that the actual returned value is not what you define in the first line (where the arrow points): def sum_numbers(n1: int, n2: int) -> int: return str(n1 + n2) B, you call the function/method with arguments not matching their annotated types: sum_numbers(n1="string", n2=True) So, whenever you create a method that returns nothing, you can also emphasize it by putting -> None at the end of the definition, like... def useless_printer() -> None: print("I don't return anything") ...and when you call it: result = useless_printer() >>> "I don't return anything" print(result) >>> None Whereas you call the other method that has a returned value... result = sum_numbers(3, 4) print(result) >>> 7 I hope it's clear now, let me know if I can help with anything else!
@shauryagupta36449 ай бұрын
@@orkslayergamedev Ohh gotcha, thanks a lot for such a fast and comprehensive reply!
@orkslayergamedev9 ай бұрын
No problem, glad to be of service!
@pionayd2776 ай бұрын
Better than my CS teacher
@orkslayergamedev6 ай бұрын
Thanks so much for the kind words! 🙏
@zettwire10 ай бұрын
hmm just a quick question... do you know the difference between PascalCase and camelCase ?
@orkslayergamedev10 ай бұрын
Sure thing! Just two naming conventions with the difference of the first letter of the first word being capitalized or not. Although camelCase is not commonly used with Python. Funny thing is that people tend to mistake PascalCase with camelCase thinking it's CamelCase (like camels with two humps, lol), I do it sometimes too, unintentionally of course
@shalevforfor555011 ай бұрын
OK good to know thx and after it you need to add it visually if you code in pygame ehat make the code longer
@orkslayergamedev11 ай бұрын
Sure thing! I worked a lot with health bars using Pygame. Including cool visual effects like bubbles in the bar, dynamic decrease/increase instead of instant, so on. I think I even gave some insights in the #8 devlog of Ork Slayer
@getcake868010 ай бұрын
Hey, I'm very new to Python. I was trying to copy your code word for word. I'm halfway the video but when I try to test I get error. It seems that whenever I type "from weapon import iron_sword" it says "unresesolved reference 'weapon' "
@orkslayergamedev10 ай бұрын
Hey there! We usually get this error when the module we want to import is not in the same directory. If you're sure that all the files are in the same place, you can also try to use "from .weapon import iron_sword" to explicitly say that the file you're looking for is within that local folder. Let me know if it worked!
@ninobrouwers18189 ай бұрын
not the person who asked the question but I had the same problem. This helped! thanks
@GamingGuruImMortaL Жыл бұрын
Easy to understand explanation👍🏻
@orkslayergamedev Жыл бұрын
Thanks a lot, bro! I was aiming to make it as beginner-friendly as possible 😁
@GamingGuruImMortaL Жыл бұрын
@@orkslayergamedev will you be doing a mini game tutorial with pygame-ce?
@orkslayergamedev Жыл бұрын
Couldn't say no to a top sub 😎 I think the space shooter tutorial (that comes after I documented my latest game) would go well with the imporved performance of pygame-ce, especially for the transparent displaying and scaling. But if you have any suggestions, I'm open for ideas 👌🏻
@GamingGuruImMortaL Жыл бұрын
@@orkslayergamedev that sounds great, I was like thinking of a complete game starting from a home page (with settings and start button) then the game and the end screen. Showcasing the transition that takes place between these scenes. There are many tutorials online on how to code game mechanics but there are almost none teaching how to make a complete game.
@orkslayergamedev Жыл бұрын
That's actually a great idea! It won't increase the overall complexity of my tutorial too much, so why not. Let the needs of my people be satisfied 🙌🏻 First some space shooter devlogs, than this complete space shooter game tutorial 👌🏻
@8-bite393 Жыл бұрын
It is very nice to see the progress in the video, but without my own thoughts it is very confusing to follow along :)
@orkslayergamedev Жыл бұрын
Thanks for the feedback! Don't worry, when I started learning classes years ago, it was very confusing for me too. It's not a simple concept to comprehend especially if you just started learning programming. Although the more and more you use classes, the easier the whole language is gonna be. So keep practicing and one day it will be easy as 1+1 :)
@Dragontbone10 ай бұрын
For those who dont want to type out all of the colors because its a slight pain in the ass, here you go: colors: dict = {"red": "\033[91m", "purple": "\33[95m","blue": "\33[34m", "blue2": "\33[36m","blue3": "\33[96m", "green": "\033[92m","green2": "\033[32m", "yellow": "\33[93m","grey": "\33[37m", "default": "\033[0m", }
@orkslayergamedev10 ай бұрын
In case anybody wants to copy my code or just needs to double-check everything, I have the git repository linked in the description! But thanks for pointing this out 🙏🏻
@Dragontbone10 ай бұрын
@@orkslayergamedevI figured you did it on purpose to have people type this themselves. I just didn’t want anyone to deal with typing the colors since they are a little clunky to type in and Visual Studio Code doesn’t auto complete. 😂
@orkslayergamedev10 ай бұрын
Right! I'm guilty as well for copy-pasting the colors in the video, don't worry 😁 If you need auto-completion with VSCode, I recommend GitHub Copilot which is a damn useful addition! It's not free but it's almost like it reads your mind! I don't use it myself but it's popular amongst my colleagues :)
@theosouza1657 ай бұрын
can you explain the: else ' ' :part of the code in the draw method for health bar. self.color if self.is_colored else '' im confused on exactly what this bit of code is doing
@orkslayergamedev7 ай бұрын
Hey! I apologize for the late reply, hope you figured out by now. If not, don't worry, let me explain. The expression you mentioned decides if the text after that row (the bars of the health bar) should be colored or not. If the self.is_colored is True, then the color code will be applied, coloring the health bar. Otherwise, if the self.is_colored is False, we'll leave an empty string there that does nothing. This way the bar won't be colored. Let me know if it's clear for you now! 🐍
@codecaine8 ай бұрын
Well done
@orkslayergamedev8 ай бұрын
Thank you! 🙌🏻
@secretnobody646011 ай бұрын
Could you show us guided tutorials for making minigame projects for python? I am a student in uni and i wanna focus on python for data science. But i need to master it first, by making games i will be able to relate to it and understand it much better because i am a gamer too!!. And i can show these projects to employers!
@orkslayergamedev11 ай бұрын
Hey there, welcome here! 👋🏻 I started with small games too and now I'm a hired software engineer, so I was in the same boots :) I'd be happy to help with minigame tutorials and I'm always open for suggestions! I planned a space shooter game tutorial - that was postponed from last year unfortunately - with similar design as my almost complete Field Trip. Feel free to take a look at some of my recent videos, I could make a fairly simplified version of that game for a tutorial. Hope you like the idea!
@secretnobody646011 ай бұрын
@@orkslayergamedev yeah! Exactly!! I wanna follow some of your footsteps. I was thinking about you doing another video for the games that you uploaded. A separate video on the behind the scenes of how you made that game, what are your thought process, the codes that gave solution, functions that were used etc. I would love to watch those and in the end i will also be able to make my own version of your game! ❤️
@orkslayergamedev11 ай бұрын
I'll try to live up to your expectations and continue delivering quality content! 🤞🏻 What I can promise besides whole minigame / feature tutorials is insights from - the close-to-release - Field Trip (eg. I plan to show some reuseable code to implement lots of different powerups quickly); then restarting the development of Ork Slayer and documenting the whole process on the channel! We will get there soon, thanks for sticking with us 🙌🏻❤️
@jogalysyndrone1316 Жыл бұрын
very cool!
@orkslayergamedev Жыл бұрын
Thank you very much! 🙏🏻
@Balance0807 ай бұрын
Great vid Ork, very educational and informative, could you help with one error i got at the very end: self.health_bar = HealthBar(self, color="blue") TypeError: HealthBar() takes no arguments | any help would be appreciated, thanks.
@orkslayergamedev7 ай бұрын
Hey there! Thanks again for the feedback, much appreciated! I replied to your other comment with the solution, please take a look and tell me if it helped! 🙌
@Balance0807 ай бұрын
@@orkslayergamedev Hi Thnaks for the reply, and sorry for commenting on the wrong vid, had both open and commented on that one by mistake. As for my Init(s), i double checked all of them, and all of them are __Init__ (double underscored) no exceptions. still get it. Here's the relevant code: CHARACTER CLASS class Hero(Character): def __init__(self, name: str, health: int) -> None: super().__init__(name=name, health=health) self.default_weapon = self.weapon self.health_bar = HealthBar(self, color="blue") HP CLASS def __init__(self, entity, length: int = 20, is_colored: bool = True, color: str = "") -> None: self.entity = entity self.length = length self.max_value = entity.health_max self.current_value = entity.health self.is_colored = is_colored self.color = self.colors.get(color) or self.colors["default"] I don't think any typos are causing this, if you have any idea i would appreciate it? Thanks for your time. EDIT: one very strange thing is that once hover over the color in "HealthBar(self, color="blue")" it says "(function) color: any", but the init in hp class says "(parameter) color: str". This is the only place this happens all other inits. are correctly taking paramaters and all calls are sending paramaters to the class constructor, is it possible there's some inbuilt color function that's colliding with my paramater
@orkslayergamedev7 ай бұрын
No problem buddy, hope we can figure this out. This issue is strange indeed. I copied the snippet you sent me to a fresh file and added minimal extra code to make it exectuable. When I hover over to the color argument of HealthBar in Hero, I get the right and expected hints. Please copy the following to a new file and try to run it with python in the console. If all is correct, you should see no messages on the screen. Give it a try. class HealthBar: colors: dict = {"red": "\033[91m", "purple": "\33[95m", "blue": "\33[34m", "blue2": "\33[36m", "blue3": "\33[96m", "green": "\033[92m", "green2": "\033[32m", "brown": "\33[33m", "yellow": "\33[93m", "grey": "\33[37m", "default": "\033[0m" } def __init__(self, entity, length: int = 20, is_colored: bool = True, color: str = "") -> None: self.entity = entity self.length = length self.max_value = entity.health_max self.current_value = entity.health self.is_colored = is_colored self.color = self.colors.get(color) or self.colors["default"] class Character: health_bar: HealthBar def __init__(self, name: str, health: int, ) -> None: self.name = name self.health = health self.health_max = health self.weapon = "" class Hero(Character): def __init__(self, name: str, health: int) -> None: super().__init__(name=name, health=health) self.default_weapon = self.weapon self.health_bar = HealthBar(self, color="blue") if __name__ == "__main__": char = Hero(name="dummy", health=10) assert char.health_bar
@Balance0807 ай бұрын
@@orkslayergamedev Done, it does work and show no error messages, only needed to add 2 more underscores to the if _name_ (i assume the youtube commets are deleting some underscores) As for this ""self.health_bar = HealthBar(self, color="blue")" hovering over color=blue now correctly shows "(parameter) color: str" and not function
@LBCreateSpace6 ай бұрын
Great explanations
@orkslayergamedev6 ай бұрын
Thanks a lot! 🙌🏻
@ymellow.5 ай бұрын
This was such a good video
@orkslayergamedev5 ай бұрын
Thanks so much, I appreciate it! 🙏
@Game_Masters16 күн бұрын
amazing video nice
@orkslayergamedev12 күн бұрын
Thanks a lot! 🙏
@MyriadColorsCM Жыл бұрын
Can you make the repository for this available again? Thanks.
@orkslayergamedev Жыл бұрын
Oh, my bad! I thought it was ready and set to public, thanks for letting me know. 👇🏻 You can access it from now on :) github.com/orkslayergamedev/python-classes-text-battle
@MyriadColorsCM Жыл бұрын
@@orkslayergamedev Thank you, great tutorial btw, forgot to say. :P
@orkslayergamedev Жыл бұрын
Thank you very much, I appreciate it! 🙌🏻
@AndrasBalintBoroczky9 ай бұрын
How did you open the builtins.py file?
@orkslayergamedev9 ай бұрын
Simply double-tap shift in PyCharm, then type builtins.py 🙌🏻 Alternatively, hold ctrl then click any class/method that redirects you to the file
@AndrasBalintBoroczky9 ай бұрын
Thank you!
@tjb31717 ай бұрын
awesome, thanks!!
@orkslayergamedev7 ай бұрын
Glad you enjoyed it! 🙌
@djalmatech9 ай бұрын
Its very nice seen all what I learned as a borring way in a fun way, also, I notice the mistakes right away, buts its fine, nice video my boy 1+sub
@orkslayergamedev8 ай бұрын
I'm glad you enjoyed the video even with experience in oop! Thanks for joining! 🙏🏻
@Xmanu_RR6 ай бұрын
hi. what color sheme do you use?
@orkslayergamedev6 ай бұрын
Hey! It's the One Dark Italic style from the One Dark Theme plugin. You can find it here: plugins.jetbrains.com/plugin/11938-one-dark-theme
@Xmanu_RR6 ай бұрын
@@orkslayergamedev tks
@8-bite393 Жыл бұрын
Hey there it’s me again! Can you tell me, why there is the None-Value in the def‘s ? Without it, it also works fine. Thx 🙏
@orkslayergamedev Жыл бұрын
Hi! I'd be happy to explain. Functions/methods have that functionality to return values to the user. The returned value can be anything. It can even be nothing, if we don't put the return statement into them. Take this for example: def sum_values(number_1, number_2): return number_1 + number_2 If you call this method, like: sum_values(5, 3) It will return the number 8 to you. Or you can create other kinds of methods that won't return anything like: def print_something(text): print(text) Another optional thing you can do with python is leavign type hints / annotations of parameters and returned values of functions/methods. The above functions with type hints: def sum_values(number_1: int, number_2: int) -> int: return number_1, number_2 def print_something(text: str) -> None: print(text) This way you're making it clear what to expect those values to be and your code editor can suggest you type-specific attributes/methods of that value. It's totally not necessary and your code will work just fine without them. Although I like to include them everywhere as it makes your code more clear, especially when you work on a bigger project. Hope this helps! :)
@ZeroSpawn10 ай бұрын
@@orkslayergamedevwooooo! Thank you. I have had that question for 14 years
@orkslayergamedev10 ай бұрын
@@ZeroSpawn My pleasure, I'm glad if it's clear for you now! Happy coding to you 🐍
@kevinmaas786710 ай бұрын
can u make this video for javascript version please? if u already did it please give me the link
@orkslayergamedev10 ай бұрын
My expertise is limited to Python at the moment, unfortunately. Although if anytime in the future I'll deal with javascript, I'll make such a video, promise! 🙏🏻
@FXOzero5 ай бұрын
Subbed and liked
@orkslayergamedev12 күн бұрын
Much appreciated! Welcome aboard!
@your_boi_junior45314 ай бұрын
little knowledge on java script and python just gona go in and see the most of it,
@orkslayergamedev12 күн бұрын
That's a great way to start! With solid foundations, you can go really far. Wishing you the best on your journey! 🐍