0 votes

Hello, I would like to know how to make a multi-character system (so you can play with more than 1 playable character) in Godot 2D.

Thanks in advance.

in Engine by (14 points)

Are you going for multiple characters controlled by different keys/controllers or a system to switch the character but always play with the same keys/controller?

A system to switch between characters, much like GTA 5

1 Answer

+1 vote

For multiplayer online games, have a look at the demo projects provided in

https://github.com/godotengine/godot-demo-projects/tree/master/networking

For games with two players sharing one screen, I'd recommend the splitscreen demo by KidsCanCode:

http://kidscancode.org/blog/2018/07/godot3_splitscreen/

If you want one player to switch between different characters, you can simply define different controls for the characters (WASD for one, cursor keys for the other), or implement a switching mechanism, e.g. update an "active_character" variable every time a character is selected with a mouse click, space key, tab key...

by (1,758 points)

Could you explain more about the switching mechanism with active_character!

What exactly do you want to know? You basically track the active player node with a variable and assign the camera and movement commands accordingly. Here's a quick demo:

https://github.com/t-karcher/Player-Switch-Demo

Let me know if you have any specific questions.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.