Development Log 10/24/18

mnzrdamageexample

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;

//then…

void Awake()

{

gunDamage = GameObject.FindGameObjectWithTag(“Player”).GetComponentInChildren<ArmControllerScript>().ShootSettings.damagePerShot;

}

//then…

void ShowFloatingText()
{

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.

 

-J

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s