Quantcast
Channel: Questions in topic: "melee"
Viewing all articles
Browse latest Browse all 201

Having trouble with melee attack script

$
0
0
Here's the aforementioned script: public float attackDuration = 0.3F; public bool attacking; [HideInInspector] void Start() { } void Update() { if (Input.GetButtonDown("Attack")) { attacking = true; } EnableDamage(); } void OnTriggerEnter2D(Collider2D col) { if (col.tag =="Enemy") { if (col.tag == "Enemy") { col.SendMessage("LevaDano", 1, SendMessageOptions.DontRequireReceiver); } } } void EnableDamage() { if (attacking == true) return; attacking = true; StartCoroutine("DisableDamage"); } IEnumerator DisableDamage() { yield return new WaitForSeconds(attackDuration); attacking = false; } The main problem is that i can't get `attacking` back to `false` no matter what. How to proceed? Also, feel free to warn me about any other bugs.

Viewing all articles
Browse latest Browse all 201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>