+ 1
How do I put it so that in my videogame I can change my character?
11 Answers
+ 1
I am going to assume that each character has a different behaviour. This is how I would do it:
1. Create an empty game object which is going to control the rules of the game. A script is going to be attached to this game object and you need to make sure it does not destroy when loading different scenes by writing: DontDestroyOnLoad(gameObject) in the awake method.
You also need to make sure that just one instance of this game object is created by using a software pattern design known as singleton.
2. Design the menu where the user is going to select which player they will use.
3. Implement a button in the previous canvas with an action from the script attached to the game object created in step1.
4. The action is actually a method which will check which player is going to be selected. And as this object does not destroy on load, then when you load the scene where you actually play, you can instantiate the correct character.
5.Also make sure you have an abstract class where the behaviours and attributes of all players are defined. And then just create subclasses for each character. This last step is not mandatory but it is good pracctice.
I hope I made myself understood.
Have fun
+ 2
Daniel Villa and if you need tutorial, I have a channel suggestion. It is Redfoc Tutorial
+ 1
Daniel Villa u can try Construct 2, you can make awesome 2d Game with it.
+ 1
Good luck
0
are you using a certain game engine like unity or cryengine?
0
Unity (and visual studio for project C#).
(characters in 2D)
0
if by changing character you mean being able to select which player will be playable, then you could have several player prefabs, And with a script you could instantiate the one that was selected.
On the other hand, if by changing character you mean being able to swap between characteres at run time, then it would be a little bit complicated, but can be achieved through a script that enables one gameobjet and disables another one.
Be more explicit with what you want to do, and I could help you better
0
For example, in the Fornite you go to a menu of character selection where you can buy or choose a character to play, like that menu so that in my video game you can choose different characters to play (characters in 2D)
0
Thank you very much.
I do not understand it very much because I just started alone without being taught since I can not go to a course because of my age (in summer I'll try to go to one, in 2 months), I'll see some video on YouTube, but thank you very much
0
ok thanks
0
ok