@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
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
I tested the code as described here:How to test code and give help?
with this user:
the result is:
Congratulation! Hats down!!!
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.
its 6 as the title says
oh ok(20charssssssss)