this post was submitted on 08 Jun 2026
11 points (92.3% liked)
Godot
7673 readers
71 users here now
Welcome to the programming.dev Godot community!
This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.
Make sure to follow the Godot CoC while chatting
We have a matrix room that can be used for chatting with other members of the community here
Links
Other Communities
- !inat@programming.dev
- !play_my_game@programming.dev
- !destroy_my_game@programming.dev
- !voxel_dev@programming.dev
- !roguelikedev@programming.dev
- !game_design@programming.dev
- !gamedev@programming.dev
Rules
- Posts need to be in english
- Posts with explicit content must be tagged with nsfw
- We do not condone harassment inside the community as well as trolling or equivalent behaviour
- Do not post illegal materials or post things encouraging actions such as pirating games
We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent
Wormhole
Credits
- The icon is a modified version of the official godot engine logo (changing the colors to a gradient and black background)
- The banner is from Godot Design
founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I've only just started with Godot so I can't give you anything Godot-specific, but it sounds like you're asking for the logic to link things together. I'll make some recommendations here but you'll definitely have to adapt it to work for you. There's a few different ways to do this and it depends on exactly how you want your system to work. From what you've said it seems like you have (or want) two classes, a PointManager and an EquipableItem (or whatever you've called the class in your pastebin).
What do you mean by groups here? You've identified global groups as a potential approach and that does seem to be a reasonable approach to access your EquipableItems from your PointManager, but I'm not sure that's what you're actually asking about. You'd have to set up a group for each category of item and add your items to the appropriate groups as they spawn, that seems a bit excessive.
The first approach to grouping objects I'd use would be with enums, this gives you fixed pre-defined categories so is useful for assigning an equip slot to each item, for instance.
You can then verify this at two points: when you try to equip a new item you can verify that that slot isn't already used, and when you count points you can make sure you only count each slot once. If you want to put an item in multiple slots (eg a dress is torso+leg) you can look into bitwise enums and bitwise logic, but that's a little more advanced so I'd recommend getting the groundwork in first.
The second approach I'd use is a tags system, this is more flexible and can be be used for categorising outfits into as many categories as you want. The simplest way to do this is just an array of string IDs or ints, but this is more prone to user error since you can typo the string or enter the wrong number. On the plus side there's no central enum so you can add new categories whenever you want, even creating a custom category at runtime if you need to.
My first approach here is just to fire an event to make your PointManager recalculate. Ideally your manager would be doing all of the calculation and the equipped items wouldn't hold any of that logic, but you would need a function on the items themselves to they can check if they can be counted (ie in the correct position). I believe in Godot that would be using the Signals system, full tutorial in the docs here. Event-driven programming is incredibly useful for game dev, even if you decide not to use this approach here I'd still recommend trying to get the hang of it.
Your drag function is doing a lot so it does need split up and simplified a bit, but for our purposes it'll be enough to combine the two elif branches since they're doing the same thing, that lets us fire the event in one place for both successful and unsuccessful drag so we can recalculate the score. You'll end up with something along these lines:
The major benefit to using events here is that it almost completely decouples your scoring system from your items, your items shouldn't need to reference your scoring system at all but they'll still be counted as needed. You can swap in different items without touching the point manager, and you can write a completely new point manager without having to update anything on the items. There's exceptions for everything, but as a general rule of thumb the more tightly coupled your code is the harder it is to maintain.
This depends on exactly how you want the items to score together, but we can handle that with the tags we set up before. Let's say for instance we're only scoring items with a specific category, we can simply check if the item has that specific tag before we score it.
Or we could use the same idea to, for instance, only score whatever outfit category appears the most
Obviously this is all very rough but it should at least give you somewhere to start with your logic.