I'm trying to make AI for an enemy and i want to make them run to where they last saw the enemy. To do this, i made a sprite that would spawn when the enemy sees the player. The problem is, how does the game know which enemy has seen the player. To fix this I made an instance variable for the enemy and the sprite that last saw you. I then made the enemy have a random number and tried to make the object that follows the player that same value but i cant get the object that follows the player's instance variable to be dependent on the enemy's instance variable. Please Help .