Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Stuck on mixed unit tactics help

i don’t understand what to do

Well, try to make the level and after that ask for help.

Andrei

2 Likes

im trying I don’t understand how to make my hero to move

You can not. You just need to command your troops.

Andrei

2 Likes

im stuck still on how to summon my troops
hello you there

Can you show me your code?

Andrei

2 Likes
summonTypes = ['archer', 'archer', 'archer', 'archer', 'archer', 'archer', 'soldier']

def summonTroops():
    # Use % to wrap around the summonTypes array based on len(hero.built)
    #type = summonTypes[???]
    hero.say("I should summon troops!")
    hero.command(archer, "attack", enemy)

Here put

hero.summon(summonTypes[len(hero.built)%len(summonTypes)])

And delete this

Now try to make a function that finds the nearest item to the hero and moves the hero to its posititon.

Andrei

2 Likes

can you show me the code to pick up coins please

hello are you there andrei

is anyone there im still stuck

You would start with def nameOfFunction(): wouldn’t you? Next you need to define some variables. Your nearest coin would be a good one. Then you check if it’s there and, if it is, moveXY() to it’s .pos.x and .pos.y.
Once you’ve attempted to do this please post your new code.
Danny

2 Likes

don’t have one right now im just doing something else

1 Like