home *** CD-ROM | disk | FTP | other *** search
- class PlayerBallInterceptorHandler
- {
- var players;
- var ball;
- var posPrecision;
- function PlayerBallInterceptorHandler(players, ball)
- {
- this.players = players;
- this.ball = ball;
- this.posPrecision = 20;
- }
- function analysis(playerShooterNumber)
- {
- var _loc2_ = undefined;
- _loc2_ = 0;
- while(_loc2_ < this.players.length)
- {
- if(this.ball.getX() <= this.players[_loc2_].getX() + this.posPrecision && this.ball.getX() >= this.players[_loc2_].getX() - this.posPrecision)
- {
- if(this.ball.getY() <= this.players[_loc2_].getY() + this.posPrecision && this.ball.getY() >= this.players[_loc2_].getY() - this.posPrecision)
- {
- if(this.ball.isBallInAirTest() == false)
- {
- if(playerShooterNumber != _loc2_)
- {
- trace("PlayerBallInterceptorHandler - Ball Interception by Player " + _loc2_ + " !");
- this.ball.interruptMovement();
- this.players[playerShooterNumber].setPlayerBallOwner(false);
- this.players[_loc2_].setPlayerBallOwner(true);
- this.ball.setInitialScale();
- return true;
- }
- }
- }
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function trace()
- {
- trace("PlayerBallInterceptorHandler - Umount Players : " + this.players.length);
- trace("PlayerBallInterceptorHandler - PosPrecision \t: \t\t" + this.posPrecision);
- }
- }
-