Object-Oriented Programming (OOP) in Godot: Master Classes and Implementation Guide

preview_player
Показать описание
Learn the fundamentals of Object-Oriented Programming (OOP) and discover how to implement it effectively in Godot, the popular open-source game development engine. In this comprehensive tutorial series, we'll dive deep into OOP concepts, including classes, objects, inheritance, and polymorphism. Whether you're a beginner or an experienced Godot user, this step-by-step guide will empower you to leverage OOP principles to create robust and modular game projects. Join us on this educational journey and unlock the full potential of Godot's OOP capabilities!

Udemy Course:
FIRST 5 DAYS COUPON:
FIRST 30 DAYS COUPON:

Рекомендации по теме
Комментарии
Автор

Scientific classification is a great example of Classes and inheritance.
A Dog is a Mammal, so it inherits things like fur, while a mammal is a vertebrate so they inherit spinal cords, etc. As you work down a dog has a spine because mammals do because vertebrates do.

This is a “is a” class based inheritance example. I’m sure you’ll do composition based “has a” relationships.

Any_key
Автор

Thank you! No intro, informative and to-the-point. Theory first, practice second. Subbed!

alexmcfly
Автор

This is the most useful tutorial I've seen on the subject, how is this not the first result?😊

pros_
Автор

I am a beginner, your video was very helpful to me.

moxingames
Автор

On the topic of class_names though, I find them incredibly useful even if I don't inherit a class anywhere as it lets me reference or instantiate, say a Player Scene "as Player" like so: "var player: Player = player_scene.instantiate() as Player".
Whenever I now type player. in this script I get full autocomplete for the Player class. I also can globally reference static functions the (in this case) player might have.
Another nifty use case I found is that I could check in a signal like "on_body_entered(body)" if the "body is Player:" and then specify var player: Player = body as Player" for the same effect as above all the while completely skipping the need for a group check or similar things, so I have a sure fire, easy to read way of checking if the body (or whatever gets transmitted in the signal) is the thing I wanna do stuff with.
Pretty sure there are more use cases but these come up so often for me.

hiiambarney
Автор

thank you for this man. Do you have a website where you do tutorials via articles, or just youtube only.

i_know_truth_hurts
Автор

This is very helpful, thank you so much!

katerkarlodieprinzessin
Автор

So when I try to remove the extends Node2D
It just gives me an error.
Not sure if it can be done and run the code from what I am testing. I am using Godot 4.2 currently.
OVERALL though great tutorial! and super helpful!

galacticgon
Автор

Do classes have to be branched off of a scene? Or can they be their own scripts like singletons? I'm trying to make a deck class, but when I extend I don't have access to its variables

LocdnessMomster
Автор

this is so fckng useful. I'm trying to make a moba, and I was using loaded scenes to cast abilities and it was too buggy, the properties os one ability was inflencing others, as it was all just one ability.

I think this would resolve

tangerchef
Автор

Octopuses kicked out of animal world :D

ensarija
Автор

I was trying to create a state machine, but I didn't even know about classes =V

bradexoff
Автор

bro it's great you show pokemon, but they don't really work with subclasses. if you make a subclass of moves, it won't load them in the battle. I also wanna implement randomness like in pokemon stadium 2, no idea how to assign a template to a class.new() and call it from the game (something like if pokemon1.type1 == water, pokerandlist.remove("water"))

WizQuest
Автор

And how I create a virtual function? I want o override a func in the MainClass

nubsdre
Автор

Would be better if you just showed completed classes in use then showed how they interacted, rather than empty scripts

labreynth
Автор

How is an octupus not an animal os my question

ScumlordStudio
Автор

can we consider an octopus as an animal ? 😂

alexxgg