No video

Understanding The Basics of GDScript - Godot Fundamentals

  Рет қаралды 28,176

Game Dev Artisan

Game Dev Artisan

Күн бұрын

Пікірлер: 94
@JeffreyTheSquirrl
@JeffreyTheSquirrl 3 ай бұрын
Im often searching videos that teach you how to use gdscript in godot but most videos are like: ‘here is how to use gdscript like python’ which is not what the language is for but i think i’ve finally found someone who actually explains them both together instead of them on their own so thanks
@GameDevArtisan
@GameDevArtisan 3 ай бұрын
Happy to help!
@WorstDeveloper
@WorstDeveloper 4 ай бұрын
Nice but I got a bit lost when you started with lerp, normalization, etc without explaining what it does.
@GameDevArtisan
@GameDevArtisan 2 ай бұрын
I agree, I should do better at describing less common terms/concepts. Sometimes things fall out of scope in a video and it's a hard balance to strike. I'll work on improving this in future videos.
@moix225
@moix225 2 ай бұрын
​@@GameDevArtisan Nice 👍
@Thurasiz
@Thurasiz Жыл бұрын
Nice series. One little remark for those following it. Yes you do not have to set a type for your variables, but it is not a bad idea to do so, when you have no specific reason not to. Game Dev Artisan may not have mentioned it when he did so, hinting that he already made a habit out of it. It not only helps you with performance a bit (computers love knowing what to expect beforehand, and untyped variables might need to be resized when their type changes), it also gives you a nice big warning should you ever accidentally try to assign a wrong kind of value to one of your variables, e.g. trying to put text into a variable that some other part of your code expects to hold a number. Subtracting "Hello World" from the health of your boss enemy will not lead to pretty results.
@GameDevArtisan
@GameDevArtisan Жыл бұрын
Great Callout @Thurasiz, I've tried to make a habit out of setting a type for each variable, though not all cases will allow for it, and that's ok. You're certainly right that it is more performant for the game's lower level code when it knows and can optimize for the correct typing for a variable! Thanks for the feedback and for helping others along.
@Thurasiz
@Thurasiz Жыл бұрын
@@GameDevArtisan tbf i only picked up on it because i'm trying to form that habit myself right now, and noticed it when you seemingly automatically did it. Same way i just now noticed you putting the -> void after a function in the ui episode without mentioning it.
@GameDevArtisan
@GameDevArtisan Жыл бұрын
@@Thurasiz Yea, another good catch. I'll be a bit more aware when I feel those types of details need to be called out. I'll probably do a more focused video on tips and tricks/best practices.
@Thurasiz
@Thurasiz Жыл бұрын
@@GameDevArtisan Probably a better way of handling it anyway. Throwing too many new concepts on someone just starting out might have similar effects as putting strings into functions that expect integers^^
@GameDevArtisan
@GameDevArtisan Жыл бұрын
@@Thurasiz haha exactly
@artcadedev
@artcadedev Жыл бұрын
I enjoyed watching your video even though I didn't need the tutorial, Keep up the good work
@GameDevArtisan
@GameDevArtisan Жыл бұрын
I appreciate that! I'm glad you enjoyed it!
@b2rad
@b2rad 6 ай бұрын
Very succinct and informational. Appreciate your tutorials as somebody new to Godot!
@GameDevArtisan
@GameDevArtisan 6 ай бұрын
Glad to help!
@sambrown7691
@sambrown7691 2 ай бұрын
Been following along, I just want to give a shout out to how nicely the GDScript documentation ties into the IDE, especially in terms of some of the higher level parent class method invocations, as well as the reserved functions. Really helps with putting the pieces together. For those new to programming (and he may mention this, I'm only about halfway through the video), you can hold down Control and hover your mouse over various stuff in the script. If you get an underline - you can control click into some documentation that will explain what that thing is, what it's doing, and where it came from. Great tutorial, excited to go deeper.
@GameDevArtisan
@GameDevArtisan 2 ай бұрын
Great feedback and tips! Thanks!
@ticketforlife2103
@ticketforlife2103 2 ай бұрын
Gdscrpit is underrated honestly
@GameDevArtisan
@GameDevArtisan Ай бұрын
I agree!
@drabodows
@drabodows 11 ай бұрын
Thank you for these tutorials. Very helpful for a first-time Godot user.
@GameDevArtisan
@GameDevArtisan 10 ай бұрын
Glad it was helpful!
@pavlosgang5410
@pavlosgang5410 Жыл бұрын
Good tutorial, thanks. Also cover the debugger please
@GameDevArtisan
@GameDevArtisan Жыл бұрын
I'm planning on doing a video dedicated to the debugger in the future, so stay tuned!
@troyna77
@troyna77 Ай бұрын
@@GameDevArtisan ty
@Arock01_
@Arock01_ 4 ай бұрын
Was following along with this and when it came time to run the program (16:25), i encountered a crash and it spat out the error: "Invalid get index "rotation_degrees" (on base: 'Nil'). I've been comparing what i have down to what you have and i cant see any differences that would cause this error. Any ideas?
@AakashMally
@AakashMally 4 ай бұрын
I have the same error. Maybe something changed in the new version of Godot? Any help would be appreciated.
@MimicKairatta
@MimicKairatta 4 ай бұрын
You'll need to replace the @export line with "@onready var weapon = $weapon" cause for whatever reason, the later version doesn't take it. Likely due to not recognizing the node as a expression.
@GameDevArtisan
@GameDevArtisan 2 ай бұрын
Correct, sometimes in newer Godot versions I've seen exports get lost or broken.
@lostdragon_1
@lostdragon_1 Жыл бұрын
Good but very fast and I only learned a fraction of what I could have due to the speed. This video could have been 3 videos easily for how long it takes me to understand things but maybe your target audience is already seasoned pros & I need to find others to watch first.
@GameDevArtisan
@GameDevArtisan Жыл бұрын
Sorry it feels so fast paced. It's hard to find a balance that works for everyone. I've been prepping to do more videos that dig deeper into specific topics that I can expand more details on and likely at a more digestible pace. Is there a specific area that you feel you'd like more emphasis on?
@JasonEllingsworth
@JasonEllingsworth 9 ай бұрын
@@GameDevArtisan Well it is about your title and target audience. If it is for beginners, no matter what it should be slow. Everyone else coming along that feels like it is to slow, should move along. The main struggle for me is not for loops, functions, or variables, but I am having one hell of a time every time someone does "something.something" or dot operators or whatever you call it. I think I vaguely understand that it can reference a function, and also some internal commands? Maybe a whole video could be dedicated just to that, because that is what I have been stuck on for days.
@grixxy_666
@grixxy_666 9 ай бұрын
Literally just turn the playback speed down and pause and rewind as necessary. Put at least a LITTLE effort into your education
@JasonEllingsworth
@JasonEllingsworth 9 ай бұрын
@grixxy_666 maybe put a little effort in to comprehending the actual problem. Slowing the video won't increase the explanation of what is going on.
@keemkorn
@keemkorn 8 ай бұрын
@@JasonEllingsworthtruly. Like why are we using PI/2 and PI with rotation calculations. I think the video is still really helpful, but things that get glazed over like that always make me hold the knife closer to my throat. I’m gonna end it tonight. Goodbye.
@draglorr5578
@draglorr5578 7 ай бұрын
Good video series and i thank you for them, but good lord *slow down* a bit.
@GameDevArtisan
@GameDevArtisan 6 ай бұрын
Noted! Been working to strike a balance between not too slow and not super fast. I'll be sure to dial it down a bit.
@seangalloway8669
@seangalloway8669 5 ай бұрын
it's free to replay any part of the video
@andredias5061
@andredias5061 11 ай бұрын
Could you please provide further explanation on the tank movement code in the video?
@GameDevArtisan
@GameDevArtisan 10 ай бұрын
I'm happy to dig into it in more details, feel free to jump over on the Discord server and we can chat more about it!
@SonnoMaku
@SonnoMaku 2 ай бұрын
I have zero programming knowledge so a lot of the terms and whatnot go right over my head. Guess I've got a lot more I need to figure out before I can even begin. lol
@GameDevArtisan
@GameDevArtisan 2 ай бұрын
It can be a bit overwhelming at first. It can be a hard balance to strike while using certain language to define terms. I'd like to do better at being more expressive and descriptive in future videos!
@ugib8377
@ugib8377 Ай бұрын
I've heard so many people suggest that GDScript is really similar to python. When honestly, I see a ton of similarity with C#. Just without the horde of semicolons. (Which is going to take some getting used to again...) But yeah, sure functions are defined with func. But there is type inference, or static typing. Enums. Even the comparison operators are similar. Which is lovely, because I just spent a few months learning C#. So this won't be too hard to move over to GDScript.
@GameDevArtisan
@GameDevArtisan Ай бұрын
Yea, the beautiful thing is that you can also use C# with Godot if you choose to, even mix and match GDScript with C#. I prefer the simplicity of using GDScript, but understand when some want to use C#.
@ugib8377
@ugib8377 Ай бұрын
@@GameDevArtisan Indeed. I did a fair bit of research trying to work out what version I wanted to download. All in all GDScript looks like it has more presence in tutorials, and more documentation overall. Not to mention I don't need an IDE for GDScript, where that is not the case for C#, as I read. With another point being that when you start mixing garbage collection into the whole ordeal, things can start to slow down, or act wonky. So GD script it is! I can't wait to dig in and actually work along with your videos tomorrow. Too late for me to do any meaningful learning tonight. Heh...
@BinaryBolias
@BinaryBolias 5 ай бұрын
12:32 Checking for whether the current state is STATES.FIRING or STATES.RELOADING. I've got three slight criticisms: *1:* According to the GDScript style guide, enum names ought to be in PascalCase. _e.g_ *"States"* rather than *"STATES".* *2:* The style guide also suggests preferring the plain English versions of boolean operators. _e.g_ *"or"* rather than *"||".* *3:* For this particular *if* statement - _checking whether a value is equal to one of two other values_ - you might find it more elegant to make use of Godot's *"in"* keyword, _for testing whether a value is within a string, array, range, dictionary, or node._ In this case, the states you're checking for can be slapped right into an array for comparison: *-if state == States.FIRING or state == States.RELOADING:-* 😵‍💫 *if state in [States.FIRING, States.RELOADING]:* 😎 *...* *..or..* *if state != States.READY:* ❗😱❗
@GameDevArtisan
@GameDevArtisan 4 ай бұрын
Great feedback! Thanks for sharing. I have some habits from years of coding that tend to carry into this such as naming things with different cases. I also agree the plain English operators makes sense, again old habits! Great point on the simplified use of the if statement, another great example of how many ways you can do the same thing. I do need to use the "in" operator more often, it has some great use cases! Thanks again!
@randomnumbers84269
@randomnumbers84269 10 ай бұрын
I can't believe this program changed so much in just 4 months. I'm stuck at the "@export var weapon: Node2D" part. It doesn't give me the Tank variable in the right hand panel and on top of that I have an error for the var.direction line below that.
@windy1844
@windy1844 10 ай бұрын
I had a similar problem with the @export var not showing in the 'Inspector' and it was because the 'tank.gd' script wasn't linked in the 'Script' section of the 'Inspector'. Just click in the script box at the bottom of the 'Inspector' and select the 'tank.gd' script
@GameDevArtisan
@GameDevArtisan 10 ай бұрын
If there is another error in the script that will prevent the exports from showing in the inspector, if your resolve those it should appear. If you want additional help, join us on discord and post on the help and support channel.
@weregoat529
@weregoat529 7 ай бұрын
I learned a lot, ty
@GameDevArtisan
@GameDevArtisan 6 ай бұрын
You bet!
@youngminkim923
@youngminkim923 3 ай бұрын
Thank you for great content.
@trencmivront
@trencmivront 6 ай бұрын
The code instantiate() is not working for creating bullet scene. What can I use for place of it?
@trencmivront
@trencmivront 6 ай бұрын
Can't move on without an answer
@GameDevArtisan
@GameDevArtisan 6 ай бұрын
It's a bit difficult to troubleshoot over comments, but you're welcome to open up a chat in our Discord server under the help-and-support channel. If you can provide errors you're getting we'll be happy to help. I will note that the tutorial is also in written form to help follow along with as well. gamedevartisan.com/tutorials/godot-fundamentals/gdscript-basics#bullet. Ensure the PackedScene is properly set for the exported variable to ensure the scene can instantiate.
@trencmivront
@trencmivront 6 ай бұрын
@@GameDevArtisan thanks
@ChaunceS
@ChaunceS Жыл бұрын
Great work again!
@toshhuish3053
@toshhuish3053 Жыл бұрын
Great tutorial👌
@GameDevArtisan
@GameDevArtisan Жыл бұрын
Glad you enjoyed it!
@MajorlyDevilish
@MajorlyDevilish Ай бұрын
I've followed this tutorial multiple times, looked through the code to see any mistakes, and yet, My weapon won't fire for some reason, and I don't know what to do. Edit: I figured it out! Apparently I was missing a part of a line code. What happened was in the weapon script, I was missing a "state ==" before "STATES.RELOADING"
@GameDevArtisan
@GameDevArtisan Ай бұрын
Ah yes, you have to watch out for things like expressions that lead to a block of code!
@andreasschlager2640
@andreasschlager2640 11 ай бұрын
What happens to the bullet objects that leave the screen? Are they being deleted?
@GameDevArtisan
@GameDevArtisan 11 ай бұрын
The current implementation has it so when the bullet overlaps the Area2D it will queue_free, but that means it must collide with the Area2D of our wall objects to be freed. You can also setup either a timer or distance to also queue_free to prevent orphaned bullets from remaining in the scene.
@ragnarok7976
@ragnarok7976 3 ай бұрын
I believe Godot has an onscreen component that could be added to the bullets to make them delete after they leave the visible area of the screen. I would attempt to use that if you are looking to make this change yourself.
@JadeDaFoxxo
@JadeDaFoxxo 11 ай бұрын
I added the tank scene but only the CollisionShape2D is visible? EDIT: i fixed it
@GameDevArtisan
@GameDevArtisan 10 ай бұрын
Glad you got it figured out!
@robogemp7075
@robogemp7075 7 ай бұрын
how did you fix it?
@katto554
@katto554 4 ай бұрын
got 10 minutes and 30 seconds in to the video, and so far i've scripted in a few variables for direction and velocity because godot couldn't register them in, however did not make animation nodes for the script, since i made my own sprites in my ol' reliable... ms paint, since i'm brand new to this and now, i'm having issues with the "move_and_slide" function, saying that the engine doesn't recall it in self, and i don't know what that is can you help me with this?
@GameDevArtisan
@GameDevArtisan 4 ай бұрын
Feel free to pop into the discord server and we can try and get you sorted!
@ragnarok7976
@ragnarok7976 3 ай бұрын
Does it say "extends CharacterBody2D" at the top of your script? Move and slide is a physics function that's only available on certain physics based nodes. You may have attached the script to the wrong node or you've removed the extends command or both.
@KevinLYT1
@KevinLYT1 Жыл бұрын
Good tutorial, but damn does it goes by fast when youre trying to follow haha
@GameDevArtisan
@GameDevArtisan Жыл бұрын
Thanks! Im trying to find the pace that is not too fast, and not too slow. It'll likely change as I get more in the groove. Sorry ahout that!
@user-od7tl9lv7o
@user-od7tl9lv7o 7 ай бұрын
Thanks, but the speed of the video are not good, but atleast i learned something 👌😏
@GameDevArtisan
@GameDevArtisan 6 ай бұрын
Sorry for that, I'm guessing it's a bit too fast? I know that's some feedback I've received and I'll be improving the speed in future videos.
@WesttranIock-g3o
@WesttranIock-g3o 2 күн бұрын
Clark Jennifer Hernandez Donald Hernandez Matthew
@alexanderzaugg4484
@alexanderzaugg4484 8 ай бұрын
Haha Python and "easy to read" do not go together
@GameDevArtisan
@GameDevArtisan 6 ай бұрын
Heh, not always!
@RedshirtAfficionado
@RedshirtAfficionado Ай бұрын
This tutorial is not the best for absolute beginners as you go over a lot of things without actually explaining what they are or what they do (such as @onready). You just say to set it, but not why or how it works. Thankfully godot documentation is really good.
@11nephilim
@11nephilim 3 ай бұрын
Cool tutorial but for some reason including the "else" statement to make the tank play the idle and stop moving causes the whole thing to bug out for me 🥲
4 Godot 4 Devs Make 4 Games in 44 Hours
25:19
DevLogLogan
Рет қаралды 516 М.
Bend The Impossible Bar Win $1,000
00:57
Stokes Twins
Рет қаралды 39 МЛН
Nurse's Mission: Bringing Joy to Young Lives #shorts
00:17
Fabiosa Stories
Рет қаралды 13 МЛН
How to program in Godot - GDScript Tutorial
58:10
Brackeys
Рет қаралды 617 М.
Immersive Sim in Godot 4: COGITO - Overview
8:22
Philip D
Рет қаралды 40 М.
C# is BETTER than GDScript but...
5:13
hamsterbyte
Рет қаралды 29 М.
How To PLAN your Game as a Solo Developer
16:26
Heartbeast
Рет қаралды 493 М.
Every Programming Language Ever Explained in 15 Minutes
15:29
Flash Bytes
Рет қаралды 322 М.
If You Can't Make Games After This Video, Give Up
4:37
Fredyy
Рет қаралды 899 М.
20 Advanced Coding Tips For Big Unity Projects
22:23
Tesseract
Рет қаралды 181 М.
How to Code (almost) Any Feature
9:48
DaFluffyPotato
Рет қаралды 679 М.
Everything Starts with a Note-taking System
21:23
Mischa van den Burg
Рет қаралды 246 М.