Commit 40494759 authored by Terence Martin's avatar Terence Martin

Rearrange debug code a bit

This cleans up the debug code by moving one last function upwards to
where it lives.
parent f0224daa
......@@ -2557,32 +2557,6 @@ var nurdz;
else
console.log("Cannot add ball; cell is not empty");
};
/**
* Given a ball entity which exists in the maze, set up to start
* dropping it through the maze, setting everything up as needed.
*
* For this to work, the ball provided must be stored in the maze and
* its map position must accurately reflect the position it is stored
* in, since that position will be cleared when the ball starts moving.
*
* @param {Ball} ball the ball to drop
* @param {number} speed the number of ticks between ball step stages
*/
Maze.prototype.dropBall = function (ball, speed) {
// Set the entity that is currently dropping to the one provided,
// then remove it from the maze. It will be re-added when
// it is finished moving
this._droppingBall = ball;
this._contents.clearCellAt(ball.mapPosition.x, ball.mapPosition.y);
// Ensure that the ball knows before we start that it started
// out not moving.
this._droppingBall.moveType = game.BallMoveType.BALL_MOVE_NONE;
// Now indicate that the last time the ball dropped was right now
// so that the next step in the drop happens in the future.
this._lastDropTick = this._stage.tick;
// Set up the drop speed.
this._dropSpeed = speed;
};
/**
* DEBUG METHOD
*
......@@ -2645,6 +2619,32 @@ var nurdz;
// We care not for this click.
return false;
};
/**
* Given a ball entity which exists in the maze, set up to start
* dropping it through the maze, setting everything up as needed.
*
* For this to work, the ball provided must be stored in the maze and
* its map position must accurately reflect the position it is stored
* in, since that position will be cleared when the ball starts moving.
*
* @param {Ball} ball the ball to drop
* @param {number} speed the number of ticks between ball step stages
*/
Maze.prototype.dropBall = function (ball, speed) {
// Set the entity that is currently dropping to the one provided,
// then remove it from the maze. It will be re-added when
// it is finished moving
this._droppingBall = ball;
this._contents.clearCellAt(ball.mapPosition.x, ball.mapPosition.y);
// Ensure that the ball knows before we start that it started
// out not moving.
this._droppingBall.moveType = game.BallMoveType.BALL_MOVE_NONE;
// Now indicate that the last time the ball dropped was right now
// so that the next step in the drop happens in the future.
this._lastDropTick = this._stage.tick;
// Set up the drop speed.
this._dropSpeed = speed;
};
/**
* Given a point that represents the position that is expected to be a
* ball, calculate where the next position that it should be is.
......
......@@ -682,37 +682,6 @@ module nurdz.game
console.log ("Cannot add ball; cell is not empty");
}
/**
* Given a ball entity which exists in the maze, set up to start
* dropping it through the maze, setting everything up as needed.
*
* For this to work, the ball provided must be stored in the maze and
* its map position must accurately reflect the position it is stored
* in, since that position will be cleared when the ball starts moving.
*
* @param {Ball} ball the ball to drop
* @param {number} speed the number of ticks between ball step stages
*/
private dropBall (ball : Ball, speed : number) : void
{
// Set the entity that is currently dropping to the one provided,
// then remove it from the maze. It will be re-added when
// it is finished moving
this._droppingBall = ball;
this._contents.clearCellAt (ball.mapPosition.x, ball.mapPosition.y);
// Ensure that the ball knows before we start that it started
// out not moving.
this._droppingBall.moveType = BallMoveType.BALL_MOVE_NONE;
// Now indicate that the last time the ball dropped was right now
// so that the next step in the drop happens in the future.
this._lastDropTick = this._stage.tick;
// Set up the drop speed.
this._dropSpeed = speed;
}
/**
* DEBUG METHOD
*
......@@ -788,6 +757,37 @@ module nurdz.game
return false;
}
/**
* Given a ball entity which exists in the maze, set up to start
* dropping it through the maze, setting everything up as needed.
*
* For this to work, the ball provided must be stored in the maze and
* its map position must accurately reflect the position it is stored
* in, since that position will be cleared when the ball starts moving.
*
* @param {Ball} ball the ball to drop
* @param {number} speed the number of ticks between ball step stages
*/
private dropBall (ball : Ball, speed : number) : void
{
// Set the entity that is currently dropping to the one provided,
// then remove it from the maze. It will be re-added when
// it is finished moving
this._droppingBall = ball;
this._contents.clearCellAt (ball.mapPosition.x, ball.mapPosition.y);
// Ensure that the ball knows before we start that it started
// out not moving.
this._droppingBall.moveType = BallMoveType.BALL_MOVE_NONE;
// Now indicate that the last time the ball dropped was right now
// so that the next step in the drop happens in the future.
this._lastDropTick = this._stage.tick;
// Set up the drop speed.
this._dropSpeed = speed;
}
/**
* Given a point that represents the position that is expected to be a
* ball, calculate where the next position that it should be is.
......
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