block breaking code doesn't work the way I want
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class BlockBreaking : MonoBehaviour { public int hitsNeeded = 4; public int hitsTaken;
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
BlockBreak();
}
}
void BlockBreak()
{
hitsTaken += 1; if (hitsTaken >= hitsNeeded) Destroy(gameObject);
}
}
I need help with something you may have already noticed this code block breaking code I just want it to break with the mouse when I touch it only 1 block but they all break Even if I'm stuffed in the air
Comment
Your answer
Follow this Question
Related Questions
how to arrange bricks randomly in block breaker 0 Answers
I need help writing a code that chooses between 4 kinds of blocks 0 Answers
Is it possible to call a block from a fungus flowchart in the different scene? 1 Answer
Leave/End the IEnumerator the right way. 1 Answer
How to get a dynamic z value for block placing in a specific area? 0 Answers