I don't know anything about coding.But are you trying to implement this function that works well before using the same method on other enemies?
Yes