The goal of today’s lunch break was to set up how the damage appears on screen in a way that feels arcade-like, and I think I’ve achieved that result. Also, I believe this is the first screenshot of what the game actually looks like.
There are two scripts that control this action. The first is “ArmControllerScript.cs” that sets a public int damagePerShot.
The second is “ZombieHealth.cs”, which has to do a few things to make this text appear on screen, but for the sake of brevity, we’ll just cover how it transfers the damage value, not the instantiation of the string value. The code looks something like this –
private int gunDamage;
gunDamage = GameObject.FindGameObjectWithTag(“Player”).GetComponentInChildren<ArmControllerScript>().ShootSettings.damagePerShot;
if (currentHealth >= 0)
var go = Instantiate(FlaotingTextPrefab, transform.position, Quaternion.identity, transform);
go.GetComponent<TextMesh>().text = gunDamage.ToString();
It works great. I’ll be tweaking how it looks later, but I’m satisfied with the code. After taking this screenshot I’m noticing how the inventory is really off-center. Add that to the to-dos.