Why would you expect that to work? Your playerâs hurt state does not have access to the hitbox! Also, why do you want that? The hurtbox should already have called that function and applied the correct amount of damage. Whatâs the point of calling the function here again?
well point is, I want to make player to take damage after GRAB state for certain enemies. So i wanted to call that function whenever player enter HURT state. But now i know that wont work. Then how can I make player to take damage after certain state instead of immediately.
If your bullets hold the info about how much damage they deal, but you donât want your player to take damage immediately, you have to save that damage value somewhere where the player state can still access it later. Adding a new variable to the player for that purpose seems sensible here, letâs call it scheduled_damage.
Then in your hurtbox you can set that variable:
owner.scheduled_damage += hitbox.damage
and later in your HURT state you can use it like this: