Help on Python level "Interception"


#1

I really don’t know what to do to solve this, can someone please help?


#2

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?


#3

Don’t put quotes around variable names.


#4

Hi, I tried unquoting the variable but this is what happened:


#5

Replace "Arrow tower" with enemy.
There is only one enemy in this level (the arrow tower), so the enemy variable references the arrow tower. :slight_smile:


#6

I’m really sorry, but i just can’t seem to complete this level! :confused:


#7

We are making progress, don’t worry! :smile:

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.


#8

Thankyou! It finally worked!


#9

This confused me with arrow tower but when I put in enemy, it worked


#10

Thankyou so much!

I struggled with my code on this level, but now I got it!

Thanks again!