Spell changing direction after player change,Spell independent from player
I have a spell class daughter of the player class and when the player shoots and changes sides in their move the spell changes sides as well. What can I do to spell continue its path even the player changing sides after shooting?
public GameObject RedBlame;
void Start()
{
animator = spritePlayer.GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
Movimentacao();
chamasVermelhas();
}
public class ChamasVermelhas : MonoBehaviour {
public float velocidade;
public int dano;
void Start () {
Destroy(gameObject, 4f);
}
void Update () {
transform.Translate(Vector2.right * velocidade * Time.deltaTime);
}
void OnCollisionEnter2D(Collision2D colisor)
{
if (colisor.gameObject.tag == "Inimigo")
{
Destroy(colisor.gameObject);
}
}
}
Comment
Answer by Gileno · Dec 18, 2018 at 11:17 PM
Class player shoot method:
void chamasVermelhas() { if (Input.GetButtonDown("Fire2")) {
RedBlame.SetActive(true);
}
Your answer
Follow this Question
Related Questions
8 way directional 2D attack animation? 0 Answers
Player gets stuck on moving platform 0 Answers
How to ajust position relative to rotate surface angle [Gif Exemple] 1 Answer
Mecanim problems, how do i make player idle in direction hes moving? 0 Answers
2D Side Scroller Help. I have a picture to show you! 0 Answers