Currently I am on level 48/125 on the Backwood Forest map. I read the “Goals” text and the example code:
(I cut and pasted it so I know its kind of a mess)
This function has 1 parameter: ‘target’:
# ‘target’ is a predefined variable.
enemy = hero.findNearestEnemy()
Below, ‘enemy’ is the argument. This becomes ‘target’ inside checkAndAttack.
What I do Understand:
- The function is clearly stated as ‘checkAndAttack’
- ‘target’ becomes a predefined variable
What I do NOT understand:
- How and why does the ‘enemy’ variable substitute the ‘target’ variable?