Game works sometimes, but sometimes it doesn't

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mr_Magnificent

I am making a space shooter game following a youtube tutorial series. Everything is fine but sometimes a part of the code doesn’t work. For example, if I restart the game it doesn’t work and after restarting it four times suddenly it works perfectly. if it does work sometimes it means the programming has no issue or is it. I can’t figure out what is the problem. The problem only occurs in the ship’s health hud part, it decreases every time it gets hit but sometimes it doesn’t decrease, and the ship gets destroyed, and hud is still showing that it has full health. And if it gets destroyed a button occurs, and it asks the player to restart or go to menu, but this part is also showing the same behaviour.

As you can see in the following images:

  1. As you can see ship got destroyed and hud is showing full health, and menu and restart option didn’t show

  2. And in this image health is decreasing.

  3. In this one ship get destroyed but health is at zero and menu and restart buttons appear.

This is so confusing, it is the same game and same code, please any help will be highly appreciated. Thanks in advance

PS for bad English

Edited because none of the links lead to images

Unfortunately there isn’t much we can help without more details, at this point you would have to provide a project so that it can be investigated if someone has the time to do it.

Zylann | 2019-02-26 13:53