I’m feeling sorry because I look like spamming posts on this forum, but I’m currently trying my best.
I got stuck at Desert Delta mission.
# Only attack the enemies in the enemyNames array. # Be sure to attack in order! 0 -> 1 -> 2 -> 3 enemyNames = ["Kog", "Godel", "Vorobun", "Rexxar"] hero.attack(enemyNames) hero.attack(enemyNames) # Attack enemyNames: hero.attack(enemyNames) # Attack the last element: hero.attack(enemyNames)
I know this map is for teaching the basic of basic arrange stuff. Choosing melee heroes, you’ll write only this much of code lines above, and you are done. But, when it comes to range heroes, the system says you should get closer to the targets before killing them.
And here I thought, just writing something like “hero.move(enemyNames)” would work. But, unlike attack() method, move methods didn’t accept strings (enemyNames = “Rexxar”) at all. I tried as far as I could for over an hour but didn’t manage it.
How can you specify an object from its string name?
If I had to imagine… something like…
realTarget = enemy.whoseNameIs(enemyNames)