Commit 05ae4a83 authored by Terence Martin's avatar Terence Martin

Turn off AI pushing of suggested ball

The question mark key is now a player key, so it only works while it
is the player's turn. Instead of playing the ball for the human
player, it merely jumps the player to the suggested ball and turns to
face the ball in order to set up playing.
parent b1a8a977
......@@ -108,8 +108,8 @@
<dd>Rotate player to facing; walk in direction</dd>
<dt>Spacebar</dt>
<dd>Push ball</dd>
<dt>?</dt>
<dd>Get AI to select and make a move</dd>
<dt>? (on player's turn)</dt>
<dd>Get AI suggestion of ball to play</dd>
<dt>F12</dt>
<dd>Toggle debug/editing mode</dd>
<dt>Left Click on a Ball</dt>
......
......@@ -4590,6 +4590,19 @@ var nurdz;
if (this._player.playerDirection == game.PlayerDirection.DIRECTION_DOWN)
this._maze.pushBall(this._player.mapPosition.x);
return true;
// The question mark key; this is not in ts-game-engine yet.
case 191:
// Get the AI to select a ball. If one was selected, jump
// the player to that position, turn to face it, and push.
// The push might not work if we're not already facing down,
// but that's OK.
var ball = game.AI_selectBestMove(this._maze);
if (ball != null) {
this._player.jumpTo(ball.mapPosition.x);
this._player.turnTo(game.PlayerDirection.DIRECTION_DOWN);
this._player.push();
}
return true;
// We don't handle any other keys.
default:
return false;
......@@ -4631,15 +4644,6 @@ var nurdz;
if (this._debugger.debugTracking)
this._maze.setDebugPoint(this._mouse);
return true;
// The question mark key; this is not in ts-game-engine yet.
case 191:
var ball = game.AI_selectBestMove(this._maze);
if (ball != null) {
this._player.jumpTo(ball.mapPosition.x);
this._player.push();
this._maze.pushBall(this._player.mapPosition.x);
}
break;
// Delete the contents of the current cell, if anything is
// there.
//
......
......@@ -236,6 +236,21 @@ module nurdz.game
this._maze.pushBall (this._player.mapPosition.x);
return true;
// The question mark key; this is not in ts-game-engine yet.
case 191:
// Get the AI to select a ball. If one was selected, jump
// the player to that position, turn to face it, and push.
// The push might not work if we're not already facing down,
// but that's OK.
let ball = AI_selectBestMove (this._maze);
if (ball != null)
{
this._player.jumpTo (ball.mapPosition.x);
this._player.turnTo (PlayerDirection.DIRECTION_DOWN);
this._player.push ();
}
return true;
// We don't handle any other keys.
default:
return false;
......@@ -285,17 +300,6 @@ module nurdz.game
this._maze.setDebugPoint (this._mouse);
return true;
// The question mark key; this is not in ts-game-engine yet.
case 191:
let ball = AI_selectBestMove (this._maze);
if (ball != null)
{
this._player.jumpTo (ball.mapPosition.x);
this._player.push ();
this._maze.pushBall (this._player.mapPosition.x);
}
break;
// Delete the contents of the current cell, if anything is
// there.
//
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment