I have a family of sprite objects called enemies, with different sprite object types (zombie, werewolf). I want to create a function called spawnEnemy(string enemyType) that creates a new instance of the enemyType passed (zombie, werewolf, or random if nothing is specified), after which I want to set some common instance variables.
My logic looks like this:
The issue is the bottom section (starting with setPlatformDisabled) seems to run for all existing enemies, but I just want it to run for the enemy created above. What should I be doing differently? FYI I also tried capturing and using the UID like this but it didn't help: