Can anyone help? I have been struggling with this as the code keeps telling me to replace ‘hero.attack’ with ‘hero.pos’. Where have I gone wrong??
The problem is in your function. The pet can only see line of sight and in the beginning there are no coins that it can see, thus it returns null. Normally, this would be resolved by checking to see if a coin exists before moving to its position using a simple, if coin conditional statement. However, in this situation it won’t work because the pet doesn’t actually collect coins. Therefore, it will just move to the first coin position and then move to the hero.pos. Try just using moveXY coordinates for your pet.
Alright, the level has been solved. Thank you so much!!!