That is one weird code…
First of all, you have to read the comments more carefully. It explicitly tells you the item.type must be coin, not Gold Coin. Second, you aren’t comparing anything, or checking if there’s really an item available to collect. Third, why are you defining a variable inside a function argument? Just do hero.moveXY(item.pos.x, item.pos.y)