void HealthBarComponent::update(GameObject* gameObject){ if (!checkIfAlive(gameObject)) return; setPosition(gameObject); updateHealthBar(gameObject); drawHealthBar(gameObject); }
void TargetShip::drawShip(Graphics& graphics, Bullet* bullet) { checkIfAlive(bullet); if(isAlive){ position = position + velocity; graphics.SetColor(RGB(0,15,230)); const unsigned int numLines = sizeof(TargetShipPoints) / sizeof(*TargetShipPoints); for(unsigned int x = 0; x < numLines; x++){ const Vector2D& first = TargetShipPoints[x] + position ; const Vector2D& second = TargetShipPoints[(x+1) % numLines] + position; graphics.DrawLine(first.x, first.y, second.x, second.y); } } graphics.SetColor(RGB(100,175,230)); }