1 decade ago by Imran
Hey guys!
I'm pretty new to programming in general, and I'm trying to do something here, let me explain:
I'm trying to modify the receiveDamage(); function on a per entity basis so that if Enemy A receives damage it does one thing while if Enemy B receives damage it does another thing. So far, I've done this by just adding my own receiveDamage function into every new enemy entity, but I was wondering - is there another way to do this that isn't so copy/paste heavy? I still want the core of receiveDamage to remain (lose health, check to see if entity should be killed).
Thanks guys!
I'm pretty new to programming in general, and I'm trying to do something here, let me explain:
I'm trying to modify the receiveDamage(); function on a per entity basis so that if Enemy A receives damage it does one thing while if Enemy B receives damage it does another thing. So far, I've done this by just adding my own receiveDamage function into every new enemy entity, but I was wondering - is there another way to do this that isn't so copy/paste heavy? I still want the core of receiveDamage to remain (lose health, check to see if entity should be killed).
Thanks guys!