Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Convert this */
- case "P": // Pawn
- var diff = (this.side === 1) ? 1 : -1; //Check south if black, north if white
- game.detect.singleSquareCheck(this.xpos, this.ypos + 1, 0, legalMoves);
- game.detect.singleSquareCheck(this.xpos, this.ypos - 1, 0, legalMoves);
- game.detect.singleSquareCheck(this.xpos + 1, this.ypos, 0, legalMoves);
- game.detect.singleSquareCheck(this.xpos - 1, this.ypos, 0, legalMoves);
- game.detect.singleSquareCheck(this.xpos + 1, this.ypos - diff, 0, legalMoves);
- game.detect.singleSquareCheck(this.xpos - 1, this.ypos - diff, 0, legalMoves);
- game.detect.singleSquareCheck(this.xpos, this.ypos + 1, enemy, legalMoves);
- game.detect.singleSquareCheck(this.xpos, this.ypos - 1, enemy, legalMoves);
- game.detect.singleSquareCheck(this.xpos + 1, this.ypos, enemy, legalMoves);
- game.detect.singleSquareCheck(this.xpos - 1, this.ypos, enemy, legalMoves);
- game.detect.singleSquareCheck(this.xpos + 1, this.ypos - diff, enemy, legalMoves);
- game.detect.singleSquareCheck(this.xpos - 1, this.ypos - diff, enemy, legalMoves);
- break;
- /* Into a single call using a function similar to this */
- "multiSquareCheck": function() {
- var args = Array.prototype.slice.call(arguments);
- for (i = 0; i < args.length; i++) {
- game.detect.singleSquareCheck(args[i][0], args[i][1], args[i][2], args[i][3]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment