#Hearts Management System Bug

1 messages · Page 1 of 1 (latest)

minor onyx
#

In creation of a hearts management system, I have come across a bug. When a player runs into a trap, it decreases the player's health as it should. There are only two smoll bugs that happen AFTER the player runs into a trap

One of the bugs is that the death animation doesn't happen like it used to. The other bug is when the player resets to their original position, they can switch directions, but are unable to move.

I manage the animations in my PlayerMovement Script.
https://gdl.space/orupekivey.cs

The LivesManager Script manages whenever I take damage:
https://gdl.space/yoyuzosapo.cs

And The GameManager Script manages what to do when a life is taken:
https://gdl.space/ipapecimuw.cs

Any ideas of what I would need to do differently with this so that the death animation happens and my player can move after losing a life?

dark ether
#

So where do you call the death animation?

nimble spire
#

Need more logging here

#

if your character can't move then that should give you an idea where to start checking

minor onyx
dark ether
#

That's where it's defined but where/when do you call it?

#

I only see you setting an object inactive

#

I'm also assuming line 50 should have been health greater than or equal to one.

#

As for movement, it's relative to these lines.

#

Or if the script is disabled, movement would be disabled as well though.

minor onyx
minor onyx
nimble spire
#

You need to take advantage of logging your code as it's one of the first things you should have learnt and for good reasons.

#

It's like doing all your math in your head. It works till a point where you just need to write it all out.

minor onyx
# nimble spire It seems like most problems stems from how the logic is being played out. I sugg...

There was a bit of that, but the biggest problem was that I didn't use an exit state in my animator despite calling a return to idle and re-enabling my sprite (which the re-enable fixed the lack of movement). A bit of a workaround since I could manage movement in an array, but IT WORKS!!! This feels like a Jason Hall error lol!

I decided to also roll with Time.timeScale = 0; to freeze the player at GameOver, it is a far better way of doing that than disabling the GameObject

nimble spire