Hi,
Im doing a Fighting game and I need to be able to change character for both player 1 and player 2. But I obviously do not know how to do this any help is appreciated. Thank you.
1 Answer
1To select the 2 characters you can make prefabs of both of them, and assign the spawn points to the gamepads. I don’t know how to assign spawn points to gamepads, but I’m sure someone knows how to do this. You can use this script to spawn the characters, assign the script to the spawning point(s):
static var classselected : boolean = false;
var spawnplace : Transform;
var firstcharacterobject : GameObject;
var secondcharacterobject : GameObject;
function OnGUI () {
if(classselected == false){
GUI.Box(Rect(0,0,300,500),GUIContent("Choose your class wisely"));
}
if(GUI.Button(Rect(100,100,100,100),GUIContent("First Character")) && classselected == false ){
var instance : GameObject = Instantiate(firstcharacterobject, spawnplace.position, spawnplace.rotation);
classselected = true;
}
if(GUI.Button(Rect(100,200,100,100),GUIContent("Second Character")) && classselected == false){
var instance2 : GameObject = Instantiate(secondcharacterobject, spawnplace.position, spawnplace.rotation);
classselected = true;
}
}
function Update (){
if (classselected == true){
Destroy(gameObject);
}
}
Just assign the transform of the spawn point and the 2 prefabs in the inspector.
Lots of luck with your fighting game
This question is far too broad. You haven't specified what part you need help with.
– CHPedersen+1 Christian. Please give us more informations about your problem.
– lvictorino