Day 47 — Improvements: boss enemy part 1

private float _verticalSpeed = 1.0f;
private float _rotateSpeed = 16.0f;
transform.Translate(new Vector3(0, -1, 0) * _verticalSpeed * Time.deltaTime);if (transform.position.y <= 2)
{
_verticalSpeed = 0;
if (_isRotatingRight == true)
{
transform.Rotate(new Vector3(0, 0, 1) * _rotateSpeed * Time.deltaTime);
if (transform.localEulerAngles.z >= 30.0f && transform.localEulerAngles.z < 35.0f)
{
_isRotatingRight = false;
}
}
if (_isRotatingRight == false)
{
transform.Rotate(new Vector3(0, 0, -1) *_rotateSpeed * Time.deltaTime);
if (transform.localEulerAngles.z < 330.0f && transform.localEulerAngles.z > 325.0f)
{
_isRotatingRight = true;
}
}
}
private float health = 12;
[SerializeField]
private GameObject _leftEngine;
[SerializeField]
private GameObject _rightEngine;
private void Damage()
{
_health -= 1;
if (_health <= 8)
{
_leftEngine.SetActive(true);
}
if (_health <= 4)
{
_rightEngine.SetActive(true);
}
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store