Classes In Godot Are Amazing!

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ธ.ค. 2021
  • Support the Channel: patreon.com/ChaffGames
    Check My New Course : Check My New Course : www.udemy.com/course/building...
    Get the FPS Template Here: chaffgames.com/fps-game-templ...
    Hi Guys, how’s it going. I’m back with another video to show you something else that I’ve done with my FPS game to make things a bit more streamlined and hopefully speed up development in the future.
    One of the things I knew early on in my game is that I wanted it to be easy for my add weapons to my game.
    I didn’t know (and still don't) how the final product will look. So I wanted to be able to swap in and out weapons easily without having to worry about re writing the code base every time.
    So it was off to research classes in Godot and how I can leverage this feature to make swapping guns as easy as changing the mesh.
    So what is a Class. A class is an extensible blueprint for creating objects, providing initial values for state and implementations of behaviour.
    Follow Along to Find Out more!
    Please like and Subscribe! It's truly appreciated
    #GameDevelopment #GodotTutorial #Godot
    Links to my Socials
    Instagram: / chaff.dev
    Twitter: / chaffdev
    Itch.io: chafmere.itch.io/godot-fps-co...
  • เกม

ความคิดเห็น • 12

  • @ceredev
    @ceredev 2 ปีที่แล้ว +22

    Super cool! May I suggest something?
    If every weapon has the same attributes in the class, instead of extend the weapons you can use a Resource which will tell to the instantiated class which data read. For example: you can have a rifle and a pistol. The difference is the cadence and the spray, so you can use the same class, but having two Resources: one containing the Pistol info and other one the Rifle info. In that way you can split behaviour and data, making it more flexible.

    • @Chaff_Games
      @Chaff_Games  2 ปีที่แล้ว +6

      Thanks, this is a really cool idea. I might look into it in the future.

    • @Gabu_
      @Gabu_ 2 ปีที่แล้ว +10

      I'll second this, and wholeheartedly recommend anyone watching this tutorial to look into using custom resources wherever applicable. The editor UI is still a little clunky when it comes to generating new custom resources, but that's easily overlooked when considering how much decoupling data from behavior speeds up the whole design-to-implementation process.

  • @chance_E
    @chance_E 2 ปีที่แล้ว +5

    Nice, I like Godot for these reasons as well. I've been making videos on Godot too. Been slacking lately because of school, but trying to get back into it. Really good video!

    • @Chaff_Games
      @Chaff_Games  2 ปีที่แล้ว +1

      Thanks, it can be so hard to keep the rhythm up sometimes. Keep at it 😊

  • @hery8148
    @hery8148 6 หลายเดือนก่อน +2

    if I've understood correctly, classes simplify the definition of certain functions, such as damage, and extends define what the node's inheritance represents. But if I make, for example, a knife, a pistol and a rocket launcher, how do I make knockback, damage and ammunition different and define them as inventory items for certain characters? Or for characters with different abilities and weapons, for example a normal speed sniper who climbs and a slow warrior with a charging minigun, do I have to make a specific class for each character class? And is there a difference between doing it online or solo?

    • @Chaff_Games
      @Chaff_Games  6 หลายเดือนก่อน +3

      Watch my video on resources and perhaps even my full tutorial on an fps weapon manager. I use resources almost exclusively for all of this stuff now as it handles these kinds of things much easier

  • @MaoXP
    @MaoXP ปีที่แล้ว +2

    I wish there was a way to implement arms with this code

    • @Chaff_Games
      @Chaff_Games  ปีที่แล้ว +3

      Hey, yeah. Earlier this month I started working on arms and it's a completely different workflow 😣. I'll need to post a new video at some point.

  • @Szabbyhun
    @Szabbyhun ปีที่แล้ว

    So classes are something like: ScriptableObjects in Unity?

    • @quirkyzigzag
      @quirkyzigzag ปีที่แล้ว +3

      no, classes are classes

    • @quirkyzigzag
      @quirkyzigzag ปีที่แล้ว +2

      scriptable objects are objects that are scriptable, I guess you can compare them but classes are not a new invention, in unity you can make a gameobject that derives from a class