skaction

How to move enemy towards a moving player?

谁都会走 提交于 2019-11-26 13:46:59
I am creating a simple sprite kit game that will position a player on the left side of the screen, while enemies approach from the right. Since the player can be moved up and down, I want the enemies to "smartly" adjust their path towards the player. I tried removing and re-adding the SKAction sequence whenever the player moves, but the below code causes the enemies to not show at all, probably because its just adding and removing each action on every frame update, so they never have a chance to move. Hoping to get a little feedback about the best practice of creating "smart" enemies that will