[SOLVED] Odd Sandstorm yak problem


#1

Hi!

I cant complete the Odd Sandstorm level, because the humans died at the end of the level. Thats because the yaks are so agressive. The yaks kills my humans.

What to do?


#2

Can you please post your code?


#3

@PythonProfessor It works for me. I can give you a couple hints:

First, kill of all the enemies in “everybody” using a loop
Next, have your hero move to the oasis.
Then, loop through “everbody” and use everybody[index] to possess an object, then command it to move to your hero’s position.


#4

@Hellenar @_TD_RodYT

This array contains friends and ogres.

The even elements are ogres, but the odds are friends.

everybody = [‘Yetu’, ‘Tabitha’, ‘Rasha’, ‘Max’, ‘Yazul’, ‘Todd’]
enemyIndex = 0

while enemyIndex < len(everybody):
# Use square brackets to get the ogre name from the array.
ogre = everybody[enemyIndex]
# Attack using the variable holding the ogre name.
hero.attack(ogre)
# Increment by 2 to skip over friends.
enemyIndex += 2

After defeating ogres, move to the oasis.

hero.moveXY(36, 53)


#5

Was that supposed to be there?

How is that being used in the code.


#6

I think the code wasn’t the problem. Its work perfectly. I kill the goblins, and move to the red X, but in my way, the yakd attack me and the peasants.


#7

What you did is correct and the same as what I did. After the hero moves, I command use a loop and state the index.

Then, I use:

enemyIndex2 = 1;

while(enemyIndex2 < len(everybody)):

everbody[enemyIndex2].move(hero.pos)
enemyIndex2 += 2

#8

it wasn’t work, i cant reach the red X, because the yaks knock back


#9

Send a screenshot because it does not happen to me


#10


#11


#12

The spell accidentally hits the yak. Try using a melee unit (warrior) such as the 4 you get at the beginning to ensure you don’t splash onto yaks


#13

I tried and it works! Thank you! :slight_smile:


#14

No problem :smiley: Please edit your title to say [SOLVED] Odd Sandstorm yak problem