Hello,
The error message says that moveXY requires 2 numbers, but you’re passing a string in.
Do you know the difference between a string and a number?
Don’t put quotes around variable names.
Replace "Arrow tower"
with enemy
.
There is only one enemy in this level (the arrow tower), so the enemy
variable references the arrow tower.
We are making progress, don’t worry!
Your code is trying to access x
and y
properties directly in the unit object, which don’t exist there. The x
and y
properties belong to the unit’s pos
property. You need to change enemy.x
to enemy.pos.x
, likewise for the y
property and the hero’s position properties as well.
Thankyou! It finally worked!
This confused me with arrow tower but when I put in enemy, it worked
Thankyou so much!
I struggled with my code on this level, but now I got it!
Thanks again!