EntityBase, HP, and Inheritance (Combat Essentials in Godot | P1)
Вставка
- Опубліковано 4 жов 2024
- And we're starting a Godot tutorial series dedicated to the basics of combat implementation! In this video, we'll cover setting up entity base and inheritance - one of the fundamental principles of OOP.
INITIAL PROJECT: github.com/Ive...
PROJECT REPO: github.com/Ive...
o_lobster, the artist who provided me his asset pack: @sir_shazam o-lobster.itch...
AnimationPlayer node tutorial: • Animating the Player i...
SUPPORT ME▹
Subscribe to my channel: / @johnivess
Buy me a coffee: ko-fi.com/john...
Follow me on Twitter: / ivess_john
Check out my games and other products: ivess.itch.io/
My Reddit: / ivessjohn
One smart guy remarked that it might cause confusion for newcomers because with Godot's tree structure nodes that are "folded" into other nodes are also called "children", and, respectively, that which they are folded into is named the "parent". This SHOULDN'T BE CONFUSED with the parent-child relationship in inheritance. Here's the difference:
1) In the scene tree, parent and children nodes can just access each other, and that's it - children do not directly expand their parent's functionality. It's like if you had your documents in a folder - sure, they are folded, but the folder is just a container.
2) In inheritance, a parent is a base upon which a child builds its functionality. It's basically taking a knife (parent) and inventing many more specific instruments of it, like bowie knife, utility knife, combat knife, surgical knife. Children not *necessarily* expand functionality, but they do inherit the parent's features.
Exactly this!
A Player "folded", as you stated eloquently, into a Game World shouldn't need to inherit its, say, Parallax Texture for example.
Conversely, we can assume the Utility Knife should inherit it's parent "Knife"'s defining features, such as having a Blade and a Handle (I guess that is the bear necessity for a Knife).
I almost strangled god because of this, THIS is the one thing that was confusing me to no god damn end. I literally couldn't understand how to make nodes communicate with each other because no one specified this
Ive literally been looking for a tutorial like this for MONTHS now. Thank you for this
I'm super glad it helped!
Very nice tutorial, can't wait for more ! I really like this form of tutorials where people get to the point instead of writing it in real time, your editing is good !
I couldn't understand why my custom classes weren't picking up their parents child nodes!
Scene -> New *INHERITED* scene was the magic I was missing! Thanks so much for that!
I'm writting here to let you know that you have a new sub. Saludos crack.
Thanks for this simple introduction. I think I now understand how an entitybase works. Other tutorials seem to skip over it so fast I couldn't really understand it :)
I’ve seen a few of your videos now and your presentation is very simple and helpful. Thanks a ton.
You're making a great job man, I understand everything more clear than much of old tutorials. I am expecting to see your all videos.
You are a very good Godot Teacher :d
Thank you!
You mean my old tutorials are less understandable, or tutorials that were out there on a similar topic prior to me?
@@JohnIvess The second one. Most of the tutorials in youtube are outdated and hard to understand and also very long to get some tricks about Godot. (Sorry for my not clear message :D)
Great tutorial John! Very well explanied and clearly documented.
Thanks for your kind words, Tayete!
Could you do a tutorial on how to make two units fight without controlling them? Like in every rts game, two units will automatically fight each other when they get close or when given an attack command.
Thank you ❤
Nice video! Can you make an updated version for this in 3D for Godot?
I am currently trying to update the hp_max to something different for the enemy and I get the error invalid set index max_value (on base: 'Nil') with value of type 'int'. This occurs in function func set_hp_max on line healthBar.max_value = hp_max. Please help anyone. Thank you!
can you maybe link the video where you do the animation?
It's already linked as a suggestion. If you do not see it, check the description, I left a link there, too!
Ik godot 4 changed the variables.
@export var number: int = 5
Im currently using export range for species variation of stats
@export_range (1, 100) var Name: int
Im trying to add personality integers as well
is it possible to add to children levels for Base --> Species --> individual with nature? or am I mistaken?
why not use class_name for base class and then extend the base class in the player script? this way if path to base script changes game doesn't break.
Great tutorial, i just have one question. Why is there a _physics_process(delta) with the move function in it in both the enity and the player?
Because I have overwritten the functionality of Entity in the player regarding the method _physics_process(delta) that exists in both of them.
I expanded the functionality of Player compared to Entity, but regarding particularly this method the function was basically rewritten. I could write Player's new code and at the end of the method call .base(), calling the basic functionality to go after that (or something like that, can not really recall the exact way you call it). However, I preferred to not mention it because 1) I never use it, especially in Godot 2) IMO it's better to have a couple of methods rather than rewriting one big.
Hopefully, it helps.
How come most ppl just skip this? I was having a hard time cuz I'm a veteran and this engine seems so good but no one was talking about this and instead where teaching me things like hard code, only interact with objects you already have a reference...
Can you do a tutorial for enemy ai as well?
I will. It is one of the planned videos. I can't really say when to expect it exactly, but it will be eventually.
Hello!
I’ve got a little problem, when I was programing the movement of the player, I couldn’t move, but when I changed the move_left, move_right…
to ui_left, ui_right… I could finally move, do you know what’s the difference between them?
You didn't set up the move_left and move_right input actions in the Input Map. It's one of the tabs inside of your Project Settings window.
Hey.. I have a small issue to say, I really want to make this, but the github file when I click "raw" to download it says the web page is not available 😢 Is there any other way I can download all the assets?
You can download the whole repository and take the files you need from there.
@@JohnIvess how tho?
haha i'm like number 666
i cant understand what your saying at all, please speak more clear next time less scratchy
I have been coding for a while and thought the same thing. However, I will watch it a few times to get the idea down.
Thank you for sharing you knowledge, going to start today!