I am currently making a game with sprite and the spritekit library, and I am trying to add power ups. I have tried to use physics bodies to detect when the player touches the power up, however that has not worked for me as the enemies are also able to interact with it. This is a problem, as I only want the player to be able to pick up the power up and have enemies walk straight over the power ups.(The game is top down) I was wondering how I could achieve this. Thank you.
There are a lot of different ways to achieve this.
You could add in some code to the power-up sprite that checks that the colliding sprite is the player.
You could also add in some code to the enemy sprite so that when it collides with the power-up sprite nothing is done.
I'd recommend looking up some tutorials on game development with Swift. Good luck!