Understanding The Basics of GDScript - Godot Fundamentals

Поделиться
HTML-код
  • Опубликовано: 20 окт 2024

Комментарии • 95

  • @WorstDeveloper
    @WorstDeveloper 5 месяцев назад +33

    Nice but I got a bit lost when you started with lerp, normalization, etc without explaining what it does.

    • @GameDevArtisan
      @GameDevArtisan  3 месяца назад +13

      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 3 месяца назад

      ​@@GameDevArtisan Nice 👍

  • @JeffreyTheSquirrl
    @JeffreyTheSquirrl 5 месяцев назад +13

    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

  • @Thurasiz
    @Thurasiz Год назад +34

    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  Год назад +4

      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 Год назад +1

      @@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  Год назад +1

      @@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  Год назад +1

      @@Thurasiz haha exactly

  • @sambrown7691
    @sambrown7691 4 месяца назад +3

    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.

  • @artcadedev
    @artcadedev Год назад +11

    I enjoyed watching your video even though I didn't need the tutorial, Keep up the good work

  • @b2rad
    @b2rad 8 месяцев назад +5

    Very succinct and informational. Appreciate your tutorials as somebody new to Godot!

  • @drabodows
    @drabodows Год назад +5

    Thank you for these tutorials. Very helpful for a first-time Godot user.

  • @Arock01_
    @Arock01_ 5 месяцев назад +3

    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 5 месяцев назад

      I have the same error. Maybe something changed in the new version of Godot? Any help would be appreciated.

    • @MimicKairatta
      @MimicKairatta 5 месяцев назад +2

      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  3 месяца назад

      Correct, sometimes in newer Godot versions I've seen exports get lost or broken.

  • @SonnoMaku
    @SonnoMaku 3 месяца назад +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  3 месяца назад +1

      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!

  • @pavlosgang5410
    @pavlosgang5410 Год назад +3

    Good tutorial, thanks. Also cover the debugger please

    • @GameDevArtisan
      @GameDevArtisan  Год назад +2

      I'm planning on doing a video dedicated to the debugger in the future, so stay tuned!

    • @troyna77
      @troyna77 3 месяца назад

      @@GameDevArtisan ty

  • @andredias5061
    @andredias5061 Год назад +3

    Could you please provide further explanation on the tank movement code in the video?

    • @GameDevArtisan
      @GameDevArtisan  Год назад

      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!

  • @weregoat529
    @weregoat529 8 месяцев назад +1

    I learned a lot, ty

  • @ChaunceS
    @ChaunceS Год назад

    Great work again!

  • @youngminkim923
    @youngminkim923 5 месяцев назад

    Thank you for great content.

  • @elliotbarlow2932
    @elliotbarlow2932 3 дня назад

    My tank doesn’t move forward or backward unless I’m turning and the weapon doesn’t move at all

  • @draglorr5578
    @draglorr5578 8 месяцев назад +4

    Good video series and i thank you for them, but good lord *slow down* a bit.

    • @GameDevArtisan
      @GameDevArtisan  8 месяцев назад +1

      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 7 месяцев назад

      it's free to replay any part of the video

  • @randomnumbers84269
    @randomnumbers84269 11 месяцев назад +3

    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 11 месяцев назад +2

      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  11 месяцев назад +1

      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.

  • @ugib8377
    @ugib8377 2 месяца назад

    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  2 месяца назад +1

      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 2 месяца назад

      @@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 7 месяцев назад +2

    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  6 месяцев назад +1

      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!

  • @trencmivront
    @trencmivront 8 месяцев назад +1

    The code instantiate() is not working for creating bullet scene. What can I use for place of it?

    • @trencmivront
      @trencmivront 8 месяцев назад

      Can't move on without an answer

    • @GameDevArtisan
      @GameDevArtisan  8 месяцев назад

      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 8 месяцев назад

      @@GameDevArtisan thanks

  • @toshhuish3053
    @toshhuish3053 Год назад

    Great tutorial👌

  • @lostdragon_1
    @lostdragon_1 Год назад +18

    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  Год назад +7

      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 11 месяцев назад +6

      @@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 10 месяцев назад +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 10 месяцев назад +10

      @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.

    • @musilicks
      @musilicks 9 месяцев назад +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.

  • @andreasschlager2640
    @andreasschlager2640 Год назад +1

    What happens to the bullet objects that leave the screen? Are they being deleted?

    • @GameDevArtisan
      @GameDevArtisan  Год назад +3

      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 5 месяцев назад

      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.

  • @Majorlydevilish
    @Majorlydevilish 2 месяца назад

    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  2 месяца назад

      Ah yes, you have to watch out for things like expressions that lead to a block of code!

  • @JadeDaFoxxo
    @JadeDaFoxxo Год назад +1

    I added the tank scene but only the CollisionShape2D is visible?
    EDIT: i fixed it

  • @ticketforlife2103
    @ticketforlife2103 3 месяца назад +1

    Gdscrpit is underrated honestly

  • @katto554
    @katto554 6 месяцев назад

    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  6 месяцев назад

      Feel free to pop into the discord server and we can try and get you sorted!

    • @ragnarok7976
      @ragnarok7976 5 месяцев назад

      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 Год назад +3

    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!

  • @JeancholeAli
    @JeancholeAli 8 месяцев назад

    Thanks, but the speed of the video are not good, but atleast i learned something 👌😏

    • @GameDevArtisan
      @GameDevArtisan  8 месяцев назад

      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.

  • @nolanroube1009
    @nolanroube1009 Месяц назад

    Thanks, but you speak too fast (or i've look the video at 2X speed...)

  • @alexanderzaugg4484
    @alexanderzaugg4484 10 месяцев назад +2

    Haha Python and "easy to read" do not go together

  • @RedshirtAfficionado
    @RedshirtAfficionado 2 месяца назад

    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 5 месяцев назад

    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 🥲