Hello,
I’m working on a simple tanks game and i’m pretty new in unity scripting, so, i need your help, desperately. I want to create a rocket that when it touches the ground or every other object it explodes and all player that are within range receive fixed damage. The game is similar tot the “Tanks Tutorial” - Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn , but i don’t want to calculate the damage by the location of the explosion radius, just receive the same amount of damage and without any force.
This is my tank’s health script:
public class Health : MonoBehaviour
{
public const float HPmaxim = 100; - HPmaxim - max health
public float HPcurent = HPmaxim; - HPcurent - current health
public RectTransform baraHP; - baraHP - health bar
public void Damage(float amount)
{
HPcurent -= amount;
if(HPcurent <=0)
{
HPcurent = 0;
Debug.Log("Distrus");
}
baraHP.sizeDelta = new Vector2(HPcurent, baraHP.sizeDelta.y);
}
}
I have another script for bullets but only works when the bullet and the tank collide.
Can someone help me with an idea for the rocket script, please?