// Update is called once per frame void Update() { if (Input.GetKey(leftKey)) //move left { rb2d.AddForce(Vector2.left * forceMod); } if (Input.GetKey(rightKey)) //move right { rb2d.AddForce(Vector2.right * forceMod); } if (Input.GetKeyDown(KeyCode.Space)) { attack.Fire(transform.position); } if (Input.GetKeyDown(KeyCode.C)) //change to CursedShield { Destroy(shield); shield = gameObject.AddComponent <CursedShield>(); } else if (Input.GetKeyDown(KeyCode.H)) //change to HalfDamageShield { Destroy(shield); shield = gameObject.AddComponent <HalfDamageShield>(); } else if (Input.GetKeyDown(KeyCode.B)) //change to BaseShield { Destroy(shield); shield = gameObject.AddComponent <BaseShield>(); } else if (Input.GetKeyDown(KeyCode.Q)) { Destroy(shield); shield = gameObject.AddComponent <AbsorbShield>(); } else if (Input.GetKeyDown(KeyCode.T)) { Destroy(shield); shield = gameObject.AddComponent <TeleportShield>(); } healthText.text = "Health: " + health; //update health display if (shield != null) // if you have a shield { healthText.text += "\nShield: " + shield.ToString(); //update health display to show shield name } }