void AFPSGCharacter::addExtraHealth(float extraHealth) { // debug if (GEngine != NULL) { //GEngine->AddOnScreenDebugMessage(-1, 8.0f, FColor::Red, "Player had " + FString::FromInt(currentHealth) + " health before powerup"); } float newHealth = currentHealth + extraHealth; newHealth = FMath::Min(newHealth, maxHealth); setCurrentHealth(newHealth); // debug if (GEngine != NULL) { //GEngine->AddOnScreenDebugMessage(-1, 8.0f, FColor::Red, "Player has " + FString::FromInt(currentHealth) + " health after powerup"); } }
health::health(int t,int c,int initx,int inity){ setTotalHealth(t); setCurrentHealth(c); setX(initx); setY(inity); }