Follow

Gamedev, Godot question 

I'm helping a friend make a tactics game. In Godot, can I make a base "Unit" class that I can then instance with customized stats and such? I'll need to instance these units procedurally later.

In Game Maker this is quite easy as the whole engine is built around instancing, but I haven't wrapped my mind around how to approach this in Godot.

Also, does it really require a tree of 3 nodes just to have a sprite that can test for overlap with other sprites?

· · Web · 2 · 3 · 1

Gamedev, Godot question 

@eishiya Instead of prefabs being a seperate entity from maps/levels/rooms/actors/whatever, everything in godot is a tree of nodes. Here's the documentation on instancing nodetrees within a tree: docs.godotengine.org/en/stable

tl;dr: Save a tree of nodes as a PackedScene. Then at runtime, create it using the instance() function and use addchild() to put it in the current scenetree

@pyredrid Thank you! I don't know why I didn't think to search for "instancing" in the docs. Hopefully I can set this up in a nice convenient way next time I get to work on this game :D

@eishiya No worries~ Godot is really consistent with how it does a lot of things, once you get used to it anyways. :p

As for the "3 node for a sprite" thing, its pretty common to have a lot of subnodes on a node. I don't think I've had it get too unwieldy yet since its possible to categorize nodes under more nodes though. Especially when using exported NodePaths in scripts.

@pyredrid Godot just hides less from the user than GMS does, I have no problem with that :D It's just something to get used to.

In my own game, the situation's no better, so it's not even a lot to get used to xP

Gamedev, Godot question 

@eishiya 1. Yes, and I think 2 also yes, but you only have to set that up once and inherit all subsequent classes from the same scene you created.

Heartbeast on youtube has an action rpg series that deals with multiple enemies and colisions and shows how you can set up an easy to extend system for enemies, overlaps, animations and collisions.

@Wolthera Thanks! Unfortunately I don't do well with video tutorials, so I'll have a play with Godot's instancing on my own and find something that works for me :D

@eishiya Yeah, written tuts for godot is kinda tricky. Kidscancode has some as well, thankfully: kidscancode.org/godot_recipes/ has most of the stuff you need outside of the ysort stuff.

Sign in to participate in the conversation
Mastodon.ART

Mastodon.ART — Your friendly creative home on the Fediverse! Interact with friends and discover new ones, all on a platform that is community-owned and ad-free. Admin: @Curator. Moderators: @EmergencyBattle, @ScribbleAddict, @TapiocaPearl, @Otherbuttons, @katwylder