Комментарии:
It may not look stunning, but you can create a working health bar in less than 5 minutes! Not bad
Ответитьim gettting error code cs0246 on the line that says "public PlayerHealth playerHealth" anyone know how to fix this?
hoping i get a fast reply cause this was 4 years ago
Unity says: The type or namespace name 'slider' could not be found can you pls help me (I like your vids a lot)
ОтветитьCan someone explain how I can add here that life is increased by taking a boost? The video from this channel on this topic did not help me, and I'm tired for another hour and still something is wrong.
I'm trying to do something like:
if the player touches an object with a booster tag, slider +1. But there is a mistake somewhere in my thinking.
I'm having a problem, Object Reference not set to an instance of an Object. Send help pls😢.
ОтветитьI have a question but I have an object in my game like a floor spike which is supposed to have my player's health bar degenerate a bit of health, do i need to add an onTriggerEnter2D next to it because the floor spikes have the box collider 2D?
ОтветитьDoesn't work.
Edit: Now works but I changed the equation using Math.Lerp to change the answer into a float
Thanks alot!
ОтветитьI'm not sure if you'll see this, but hopefully you do. But I'm having a bug where the slider only works properly for max health and nothing else, do you know how to fix this?
ОтветитьTY TY TY
Ответитьi can't add the script into the Slider cause it says the script class cannot be found
ОтветитьYou're a legend mate, your entire channel makes bringing our ideas to life so easy even when people are just starting out. Keep it up ❤️
Ответитьthis was the only tutorial that worked for me
ОтветитьI come here now and then just for the fun part in the beginning!
ОтветитьCome on how can this video be underrated, maybe gamedevs don't like jokes?
(If you have seen a Unity's video where two people try to joke while teaching, gets the same reaction, I feel like gamedevs don't like jokes?)
I am getting a null reference for the float fillValue please help
ОтветитьThanks!
ОтветитьWOW this seems to be more better than using SetMax and Health methods.
ОтветитьI followed your both tutorials to what you exactly done but when i adjust the health of the player the health bar goes instantly to 0? unsure why
Ответитьthanks for this, love you brother man
Ответитьthanks for the tutorial, currently trying to use an Image like a face to indicate the remaining hp. but for some reason i am unable to get it working with the hp slider. the slider updates fine but the image doesnt change when hp is < MAXHP. if i could get your help id be most thankful
Ответитьpov: Your looking for the script
ОтветитьWhat’s the payer script
ОтветитьWhere i can take PlayerHealth script?
ОтветитьGreat video!
Ответитьhow do you make a health bar that goes down if you collide with something? I'm trying to make this game and I just cant find a way to make my player lose health if it collides with an enemy object. Plz help
ОтветитьBro can you make a video for 2020 unity but good video bro keep it up
Ответитьdoes this video has a next video? i mean how can we reduce the current health bar
Ответитьhow did you create the currenthealth?
ОтветитьPlease help me i am literally having a pain
Ответитьİ cant find the player health script, and idont see it on the video
Ответитьwhere is the player health script ?
Ответитьhow do i make something damgage the player? i watch all the comments tried the solutions you gave them and did not work :(
Ответитьput the castle is still attacking you even after you died? how to stop them attack when u die?
ОтветитьThis video helped alot. I was searching literally for 2hrs. Thank you for making this video
Ответитьhow can we make the health bar withou the health script thanks for wasting my time
ОтветитьU didnt show us the player health script
Ответитьgonna waste my time and now show how you made the player health script ? nike
Ответитьthanks. it is really helpful.
Ответитьgood video thanks
ОтветитьSo I got it to work, but I will like to get it to work whenever an enemy shoots me or collides into me, it reduces my health. I was thinking to add it in this script yet I was getting an error: nullRefrenceException object reference not set to an instance of an object.
public class DestroyByContact : MonoBehaviour
{
public GameObject enemyExplosion;
public GameObject playerExplosion;
public PlayerHealth playerHealth;
public int scoreValue;
private GameController gameController;
private void Start()
{
GameObject gameControllerObject = GameObject.FindWithTag("GameController");
if (gameControllerObject != null)
{
gameController = gameControllerObject.GetComponent<GameController>();
}
else
{
Debug.Log("Cannot find 'GameController' script");
}
}
private void OnTriggerEnter2D(Collider2D other)
{
// Name of the given object that collided with the enemy
var name = other.tag;
// if the name of the tag is the same as to Boundary tag
// return and do nothing
if (name == "Boundary" || name == "Enemy")
{
return;
}
if(enemyExplosion != null)
{
Instantiate(enemyExplosion, this.transform.position, this.transform.rotation);
}
if (name == "Player")
{
Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
gameController.GameOver();
}
gameController.IncrementScore(scoreValue);
Destroy(other.gameObject);
Destroy(this.gameObject);
}
}
It is great indeed,however
if my currenthealth < maxHealth slider is min value
currenthealth > maxHealth slider is max value
how can i fix this
whats the player script?
Ответитьi made the player script with everything right, but forgot to make it a float. i spent way too long wondering why it wasnt working. Thanks for the video!
Ответитьwhats the script for the player health?
Ответить