Skip to content

Commit

Permalink
torus monster killing
Browse files Browse the repository at this point in the history
torus mosnter killing behavior while playing nontorus game
bug fixed
  • Loading branch information
scurryingratatosk committed Dec 1, 2012
1 parent 90f21be commit dbb70eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -14,5 +14,4 @@ https://github.com/mozilla/WebGameStub/


Todos:
error about 0 and -1
serva
18 changes: 14 additions & 4 deletions js/app.js
Expand Up @@ -557,21 +557,30 @@ require(['jquery'], function($) {

// clear skies
if(normalGo && xSideGo && ySideGo){
ret.killingMoves = [ [x,y+ydir],[x+xdir,y], [x+xdir,y+ydir] ]
ret.killingMoves = [];
if(isTorus || !outside(x,y+ydir))ret.killingMoves.push([x,y+ydir]);
if(isTorus || !outside(x+xdir,y))ret.killingMoves.push([x+xdir,y]);
if(isTorus || !outside(x+xdir,y+ydir))ret.killingMoves.push([x+xdir,y+ydir]);
return ret;
}

// mirroring on x side
if(!xSideGo && ySideGo && yBackGo){
ret.ydir = -ydir;
ret.killingMoves = [ [x,y+ydir], [x+xdir,y], [x+xdir,y-ydir] ];
ret.killingMoves = [];
if(isTorus || !outside(x,y+ydir))ret.killingMoves.push([x,y+ydir]);
if(isTorus || !outside(x+xdir,y))ret.killingMoves.push([x+xdir,y]);
if(isTorus || !outside(x+xdir,y-ydir))ret.killingMoves.push([x+xdir,y-ydir]);
return ret;
}

// mirroring on y side
if(!ySideGo && xSideGo && xBackGo){
ret.xdir = -xdir;
ret.killingMoves = [ [x+xdir,y], [x,y+ydir], [x-xdir,y+ydir] ];
ret.killingMoves = [];
if(isTorus || !outside(x,y+ydir))ret.killingMoves.push([x,y+ydir]);
if(isTorus || !outside(x+xdir,y))ret.killingMoves.push([x+xdir,y]);
if(isTorus || !outside(x-xdir,y+ydir))ret.killingMoves.push([x-xdir,y+ydir]);
return ret;
}

Expand Down Expand Up @@ -613,7 +622,8 @@ require(['jquery'], function($) {
// otherwise turning back
ret.xdir = -xdir;
ret.ydir = -ydir;
ret.killingMoves = [ [x+xdir,y+ydir] ];
ret.killingMoves = [];
if(isTorus || !outside(x+xdir,y+ydir))ret.killingMoves.push([x+xdir,y+ydir]);
return ret;
}

Expand Down

0 comments on commit dbb70eb

Please sign in to comment.