Break The Prison, Broken? Killed through door - (js)

My isFriend() method should work, but the first ogre kills Tharin through the door (2 hits). The javascript code is:

return 'William etc etc spoiler etc'.indexOf(name)!=-1;

I’ve also tried an equivalent switch(name){...}, and return name==='William' || name==='etc' || ... with the same results.

I’m using: ubuntu / chromium

If I only return false Tharin walks by all the doors jumping each time getting hit only once by the first ogre. When I use the code above he smashes the first door freeing William, but then walks (not jump) to the second door which he correctly ignores, but then gets killed just as he jumps to the third, sending him flying dead through the air. None of the move functions work from inside isFriend().

Try it again now; I’ve fixed something in the level that would have caused that. Thanks for the bug report!

No it’s still happening. It doesn’t seem like anything’s changed. He walks after the first door and waits too long at the second. Is it possible to have ogres not attack at all if the door is intact?

Do you see the ogre start to move toward you before you say “Who goes there?” Because the latest version of the level, that should be fixed. If it isn’t working yet, maybe try playing on, which does less caching?

No he comes after I say “Who goes there?”, then Tharin waits until he gets attacked.

Same happens on

Just not sure how you are seeing this still. This is what I see–he jumps away before the ogre gets down there:

It’s possible that the more clever code you are using is somehow causing the problem–if you just do it like a beginner with a series of if(name == "sth") return sth checks, does it work better?

I changed the code to the original template like in your python screenshot, i.e. separate if returning true for friend names and default return false, then it worked. Also seemed a bit faster…

But… just to check, I changed it back to my old code ( "name1 name2".indexOf()... ) and it then also worked with similar speed.

So I guess this is solved, though I’m curious as to why.

Thanks for the quick responses.