How do I make different characters have different movesets?

Godot Version

4.4.1

Question

I’m trying to make a game where each player can pick different character like a fighting game roster. How would I create a system that the player’s moves and stats are based on what character they are playing as (ie. fast char has a high speed stat and low hp while heavy char has a slow speed and high hp)

Implement several characters separately. If you notice repeating tings in those implementations, extract them into abstractions. Continue adding individual implementations and extracting abstractions until you end up with a system.

but what if 2+ players want to be the same character?

Instantiate the same thing twice :wink:

and I understand the theory of it, but I don’t know the godot implementation

Then you should perhaps start with something simpler to get well acquainted with Godot. Have you checked the introductory tutorials in the official docs? They’re short and seemingly simple, but they teach you the key concepts of the engine and show you how to utilize them in a typical game.

1 Like

Ok so you got me there, I am working on my first game in godot. However, I would rather have help with the character implementation than a link to godot basics (especially since I understand the basics and I could look that up if I wanted to. I would have to ask this question if I could look up the answer) sorry if that sounds rude :sweat_smile:

There’s no “answer” to your question. The question is too broad and the answer is: “it depends”. You need to get more specific if you want a specific answer.

But judging from how you formulated your initial question, I’d strongly recommend you go through that introductory tutorial, even if it looks boring. It may answer many of the questions you might have now and in the future.

Ok then, If I have a player script that gathers the input info and translate it to the ChariterBody2D, how could I have different sets of stats and moves that I can load into each of the inputs of the CharitaeBody2D? And could I have example code please? (it’s easier to visualize if I can see code)

Make a player scene with that character body as its top node, give it some configuration variables and instantiate the scene as many times as you have players, each instance with different values of configuration parameters.

Scenes are one of those key engine concepts demonstrated in intro tutorial I was mentioning earlier.

I only just found this and don’t have much time so sorry if I’m just saying stuff that’s already been mentioned but make several different scenes with different characters and either instantiate them (the Godot documentation to instantiating is pretty simple) or have them somewhere the player won’t get to and just bring them to the correct spot when needed. We mostly need more info or we can’t help on the forum.

I’d like the instantiation idea. So would I have a player script that has the input and then calls on the character instance to do something based on the input?

You just need to make the character logic in the character scene which should be pretty straightfoward and then just instantiate it I to the scene the logic is in the player script anyway.

Basically yes but that script needs to be inside an instantiable scene in order to make multiple copies (aka instances) of the player.

Your questions indicate that you do not understand the basics (such as instantiation). You are making the quintessential beginner’s error of trying to run before you can crawl. I second the recommendation that you spend time going through the introductory projects. It will help you a lot.

2 Likes

Use some dictionaries with different keys and values like a fast and weak character: {“health”: 15, “speed”: 100, “damage”: 15} and when you wanted to change just change what dictionary you are using. Using many different models or sprites and hiding and showing them would work for changing character visuals. I don’t recommend instantiation yet. You might want to try my alternative. Once you start adding enemies learn instantiation. It’s basically putting a scene into another scene