Hello,
I am very new to coding and have been living off of tutorials my entire time coding.
Basically, I have already have a sword that can deal contact triggers to do anything. What I need is a script for my enemies that will give them modifiable HP that causes them to be destroyed after being hit X amount of times.
Here’s my sword script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Melee_Combat : MonoBehaviour
{
//Variables;
Animator anim;
// Start is called before the first frame update
private void Start()
{
anim = GetComponent<Animator>();
}
// Update is called once per frame
private void Update()
{
if(Input.GetButtonDown("Fire1"))
anim.SetBool("attacking", true);
else if (Input.GetButtonUp("Fire1"))
anim.SetBool("attacking", false);
}
}
Remember that Unity answers is not a script provider. You must do your own script and we can help you with things that doesnt work, but not to create you a full hiting system. thats your job :D
– tormentoarmagedoomthis did not help me im very new to coding
– DWBITF