+ 3
Is there any possible way to delete a function which is inside a class?
I am trying to make a small game using pygame in python. I can't seem to find a method to delete a function which is inside a class 'Del' <function name> doesnt seem to work as it says calling func before assigning it
6 Answers
+ 2
Say you have an enemy made out of your enemy class...
enemy = Enemy()
when enemy's health drops to 0 or below,
enemy = None
+ 1
Nikhil , Why do you want to delete a function?
+ 1
Yes it works now thanksss
0
To remove a character from the game
0
You never want to do that. Why not work with deconstructors (opposite of __init__) or make a method that deletes a character once their health is gone
0
But how can I delete the character
Idk the syntax to delete it
Will check on deconstructor