How to make a clone ignore movement input when his parent is moving? HELP!
I use move_states to track character's movement, but it can only track itself, when the character splited into two characters, how to make the clone one ignore the player's input when his parent is moving.
the movement_input part of the script:
private void Movement_input() {
if (move_states == 0) {
if (Input.GetKey(KeyCode.UpArrow)) {
move_states = 1;
target_position = transform.position + new Vector3(0, 0.8f, 0);
}
else if (Input.GetKey(KeyCode.DownArrow)) {
move_states = 1;
target_position = transform.position + new Vector3(0, -0.8f, 0);
}
else if (Input.GetKey(KeyCode.LeftArrow)) {
move_states = 1;
target_position = transform.position + new Vector3(-1, 0, 0);
}
else if (Input.GetKey(KeyCode.RightArrow)) {
move_states = 1;
target_position = transform.position + new Vector3(1, 0, 0);
}
}
}
THANK TOU FOR HELPING
You know the unity script runs linear, and the engine runs all the script traversal, so if anyone moving(move_states ==1), others can not move anymore. But how can i make them move togeter as before, and only the stuck one can not move when other's moving.(if they move right together, the one on the right is at the edge of the stage, so it's a stucked one) if i press right arrorw and then press left arrorw immediately, the stucked one will walk left unexpectly the moment the left one is walking right as well. THAN$$anonymous$$S A LOT!!!