So I’m making a 1-4 player game (well, 1-2 co-op story mode and 1-4 player melee like in Smash Bros), and I have working parent-child class relationships for the types of characters so that everything inherits the capabilities of the parent, but has their own values for variables like health speed attack etc.
I have set up health bars on the screen with each one relating specifically to one of 4 players (and a 5th one for AI).
I have debug text to tell me everyone’s values, and can see each character controlled has their own values which are used by their damage health functions to lower it when they get hit. As such I can see characters losing health when I hit them.
I have an enum to denote which character’s health bar should be changed accordingly, and the code seems to progress through as expected.
But then the Set Percent function gets called (by whatever character I hit) and takes the current player health bar (which, when watched, shows the correct Progress Bar for that character I’m hitting) in and the correct percent amount (based on current health/max health), but then doesn’t seem to DO anything with those values. It then progresses to the rest of the code where it’s checking if current health is <= 50% of max health, it changes bar to yellow, and it current health is <= 25% of max health, it changes to yellow, but even when it hits the correct Compare nodes and gets to the Set Fill Color and Opacity nodes (even the ones set for less than 50% health or less than 25% health), it does not affect the progress bar at all.
My problem is that the progress bar for Player 2 is adjusted instantly when hit, but progress bars for players 1, 3 and 4 are not. At one point (without changing my code at all) it changed from working for Player 2 to working for Player 3 and not player 2, but testing again made it go back to Player 2. I’ve no idea what the heck it’s doing, but all the code and variables being watched shows it should be affecting the correct stuff.
See images below for proof the code thinks everything is correct. I could only upload 5 images so I did images 2-6, as image 1 is just the “before hitting” image, and thus doesn’t really show anything of importance.
Let me know if you want to see more images of my code!