Commit e71e3ed4 authored by Terence Martin's avatar Terence Martin

Tweak the ball drop event

It no longer gets the boolean indication; this can be determiend by
the caller based on the map position of the ball when it stopped.
parent b7594275
......@@ -4439,7 +4439,7 @@ var nurdz;
// If there is a listener, tell it that this ball has stopped
// moving now.
if (this._listener != null && this._lastDroppedBall != null)
this._listener.ballDropComplete(this._lastDroppedBall, this._lastDroppedBall.mapPosition.y == game.MAZE_HEIGHT - 2);
this._listener.ballDropComplete(this._lastDroppedBall);
// Done with the value now.
this._lastDroppedBall = null;
}
......@@ -5011,19 +5011,19 @@ var nurdz;
};
/**
* A ball drop that was in progress has now finished. The event features
* the ball that was dropped and also an indication as to whether the
* ball reached the goal or not.
* the ball that was dropped.
*
* This gets triggered once the ball comes to a rest and before it is
* vanished away (if it should be).
*
* @param {Ball} ball the ball that stopped dropping
* @param {boolean} reachedGoal true if the ball reached the goal, false
* if it stopped in the maze somewhere.
* This is triggered for any ball drop; human or computer, during the
* regular game or as the final ball drop.
*
* @param {Ball} ball the ball that stopped dropping
*/
GameScene.prototype.ballDropComplete = function (ball, reachedGoal) {
GameScene.prototype.ballDropComplete = function (ball) {
// Did the ball reach the goal? This is good enough for testing.
if (reachedGoal)
if (ball.mapPosition.y == game.MAZE_HEIGHT - 2)
console.log("GOOOOOAL!");
// Now that the ball is done, where we go depends on where we came
// from.
......
......@@ -26,17 +26,17 @@ module nurdz.game
/**
* A ball drop that was in progress has now finished. The event features
* the ball that was dropped and also an indication as to whether the
* ball reached the goal or not.
* the ball that was dropped.
*
* This gets triggered once the ball comes to a rest and before it is
* vanished away (if it should be).
*
* @param {Ball} ball the ball that stopped dropping
* @param {boolean} reachedGoal true if the ball reached the goal, false
* if it stopped in the maze somewhere.
* This is triggered for any ball drop; human or computer, during the
* regular game or as the final ball drop.
*
* @param {Ball} ball the ball that stopped dropping
*/
ballDropComplete (ball : Ball, reachedGoal : boolean) : void;
ballDropComplete (ball : Ball) : void;
/**
* This will get invoked every time we're told to generate a maze and
......@@ -1053,8 +1053,7 @@ module nurdz.game
// If there is a listener, tell it that this ball has stopped
// moving now.
if (this._listener != null && this._lastDroppedBall != null)
this._listener.ballDropComplete (this._lastDroppedBall,
this._lastDroppedBall.mapPosition.y == MAZE_HEIGHT - 2);
this._listener.ballDropComplete (this._lastDroppedBall);
// Done with the value now.
this._lastDroppedBall = null;
......
......@@ -496,20 +496,21 @@ module nurdz.game
/**
* A ball drop that was in progress has now finished. The event features
* the ball that was dropped and also an indication as to whether the
* ball reached the goal or not.
* the ball that was dropped.
*
* This gets triggered once the ball comes to a rest and before it is
* vanished away (if it should be).
*
* @param {Ball} ball the ball that stopped dropping
* @param {boolean} reachedGoal true if the ball reached the goal, false
* if it stopped in the maze somewhere.
* This is triggered for any ball drop; human or computer, during the
* regular game or as the final ball drop.
*
* @param {Ball} ball the ball that stopped dropping
*/
ballDropComplete (ball : Ball, reachedGoal : boolean) : void
ballDropComplete (ball : Ball) : void
{
// Did the ball reach the goal? This is good enough for testing.
if (reachedGoal)
if (ball.mapPosition.y == MAZE_HEIGHT - 2)
console.log ("GOOOOOAL!");
// Now that the ball is done, where we go depends on where we came
......
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