javascript - Why isn't the else block firing? -
i'm making html canvas game (tron), , i'm want game detect when player hits border of canvas. have if statement checks if player in contact either own trail or opponents, , works fine, parameter being outside of canvas ( y >= 780 ) doesn't seem doing anything. added snippet. there's library key event handling in there, that's not code (the library no longer necessary after made changes shouldn't have problem). time. /*! keydrown - v1.2.2 - 2016-03-23 - http://jeremyckahn.github.com/keydrown */ !function(a){var b=function(){var b={};b.foreach=function(a,b){var c;for(c in a)a.hasownproperty(c)&&b(a[c],c)};var c=b.foreach;b.gettranspose=function(a){var b={};return c(a,function(a,c){b[a]=c}),b},b.indexof=function(a,b){if(a.indexof)return a.indexof(b);var c,d=a.length;for(c=0;d>c;c++)if(a[c]===b)return c;return-1};var d=b.indexof;return b.pushunique=function(a,b){return-1===d(a,b)?(a.push(b),!0):!1},b.removevalue=function(a,b){var c=d(a,b);r...