I feel like I am lacking a very fundamental knowledge on how to convert these named “targets” into something the function can recognize(?). I have never taken a coding class before so i apologize if im using these terms poorly. Thank you!
Line 3: cannot read property ‘x’ of undefined
What I’m trying to do:
Find out coordinates of “friend”(Laszlo)>go to friend>get the secret>go to another named “friend”(Erzsebet)
The suggested solution since im literally a noob is
However, i highly dislike typing out coordinates if at all possible, i’ve been stuck on this for the past 3 hours and would really appreciate any help. Thank you!
Cannot read property ‘x’ of undefined
friend = "Laszlo" friendpos = friend.pos fx = friendpos.x fy = friendpos.y hero.moveXY(fx, fy)
ERROR: findNearestFriend takes no arguments.
friend = hero.findNearestFriend("Laszlo") friendpos = friend.pos fx = friendpos.x fy = friendpos.y hero.moveXY(fx, fy)
THIS WORKS but i can’t use this same code to make it go to the next friend, Erzsebet
friend = hero.findNearestFriend() friendpos = friend.pos fx = friendpos.x fy = friendpos.y hero.moveXY(fx, fy)
I know this is probably trivial for many of you but any help would be appreciated. Thank you!