Problem with infinite loop on sarven treasure 6

I always get infinite loop error message please help if u can i will post my code later

Can you post your code?

What level are you on? Etc . 1 , 2 , 3
Since this is a brawl, the best we can help you with is to figure out your infinite loop, then we cannot help you no more.
Lydia

@iLuvCookies and @Lydia_Song I will post my code asap but I need to finish homework and laundry
also thanks for coming!also @Lydia_Song I have subscribed to your channel

wait @Lydia_Song has a YT if u tell me what it is i’ll check it out.

@098765432123 here is my code

Edited in order to avoid copying. Sincerely yours, Alexbrand.

one thing i notice (thats not a problem with the code) but you use self then switch to hero why do you do that? (im at church i’ll help when im done if i can)

what i mean is why do you use self. then switch back to hero. don’t you normally use hero. and not self?

also I reset so I can not access the level

[SOLVED] The game dose not let me in a level it just infinitely load?

I tested the code as described here:How to test code and give help?
image
with this user:
image
the result is:
sarven-tresure-f
Congratulation! Hats down!!! :+1:
The problem isn’t the code
If you do not want to be copied countless times, delete the entire post.

Personally me use both self and hero)

thanks it worked(20chars)

You can define teleports as vectors and just use

teleport = hero.findNearest(teleports)

It seems to me the way Riticmaster finds the nearest portal is more efficient - with too many calculations the browser crashes

Well that makes sense.

Uhm, wait a sec.
I meant smth like this:

    t2 = Vector(77,50)
    t3 = Vector(5,50)
    t4 = Vector(77,19)
    t6 = Vector(5,19)
    teleports =[t2, t3, t4, t6]
    teleport = hero.findNearest(teleports)

Does it need many calculations?

hero.findNearest(teleports) is a loop between hero and some points finding distances between them
and sqrt is computational hungry

def calcDistance(x1,y1,x2,y2):  
     dist = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)  
     return dist

Oh, I see. Thank you very much for clarifying.

It is in my profile (click on my profile picture)
And thanks @riticmaster9087!
Lydia