Summit's gate python Help


#1

Hello! Can you help me at summit’s gate please?
I have best armor for mountain (Enameled dragon helmet, enameled dragon armor, reflector, the programmer IV, gold watch, commander star III, extended flags, rune sword, emperor’s gloves, spiky belt, ring of speed, ring of flowers, sapphire stone of sensations, twilight glasses, puma and jump shoes) and I’m not even dying, I AM OUT OF TIME!!!
Here is my “perfect” code-
while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
But he just stops because of the wall on x: 175 y: 33
What can I do so it wouldn’t happen?


#2

Use Enchanted Lenses.


#3

…and read the zillion earlier threads about the same topic:
https://discourse.codecombat.com/search?q=summit%20gate

OK, a little more help here:


#4

Twilight glasses are same as enchanted lenses but lenses can’t see through walls and twilight glasses can.

EDIT: I understand now!

EDIT 2: Now I tried to do that as you said, but then I can’t attack the doors!


#6

I had the opposite problem on this level, I couldn’t stop my hero from attacking the doors. I ended up removing enemies of type door from my list of enemies until I am ready to move through the door.

After that I ran into an issue where I couldn’t attack the door. It was because after killing all of the enemies I was against the wall and the door wasn’t in my line of sight. Since you can’t see through walls anymore, that’s probably what’s going on. Try moving to the center of the x-axis after there are no more enemies and you’ll be able to attack the door.


#7

@mgdg25 Since I am posting this nearly a week after, I am not sure if you have solved this problem yet, but in that while loop at the end where it says if enemy , try to create an elif and then attack the door. This means if there are no enemies in range hero will attack("Door").


#8

Hi. I’m new to this. I was wondering if you guys could help me with my code for the first section of summit’s gate. For some reason, it says that I have an infinite loop error. I was hoping you guys could find it so I could fix it. Also, I don’t know how to post code, so it would be great if you guys could tell me how.


#9

Ctrl + C to copy & Ctrl + V to paste
Mac: Command + C to copy & Command + V to paste


#10

To post your code from the game, use the </> button or it won’t format properly. When you click the </> button, the following will appear:
PostCode
Please paste ALL of your code inside the triple back tick marks.

``` <— Triple back tick marks.

Paste ALL of your code in here.

``` <— Triple back tick marks.

There are many people here willing and able to help. If you use the </> button correctly, then ALL of your code should look like this:

while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
    else:
        hero.say("My code is formatted properly")

If ALL of your code doesn’t look like the code above, then you’re doing it wrong and we can’t see the structure of the code to troubleshoot whether or not that is the issue. Use the </> button and help us help you. This works when sending a private message as well. Thank you.