home *** CD-ROM | disk | FTP | other *** search
- class cBall
- {
- var mc;
- var halfWidth;
- var normWidth;
- var normHeight;
- var speed;
- var dy;
- var state;
- var ffloor;
- var col = 0;
- var sideSpeed = 30;
- static var stNormal = 0;
- static var stPower = 1;
- static var stSize = 2;
- function cBall(_mc)
- {
- this.mc = _mc;
- this.halfWidth = Math.floor(this.mc._width / 2);
- this.normWidth = this.mc._width;
- this.normHeight = this.mc._height;
- }
- function normSize()
- {
- this.mc._height = 0.7 * this.normHeight;
- this.mc._width = 0.7 * this.normWidth;
- }
- function start(sp)
- {
- this.normSize();
- this.mc._x = _root.posX;
- this.mc._y = _root.posY;
- this.speed = sp;
- this.dy = 1;
- this.state = cBall.stNormal;
- this.ffloor = false;
- }
- function moveLeft()
- {
- var _loc3_ = 0;
- while(_loc3_ < this.sideSpeed && this.mc._x > this.halfWidth)
- {
- this.mc._x--;
- _loc3_ = _loc3_ + 1;
- }
- _root.checkPos();
- }
- function moveRight()
- {
- var _loc3_ = 0;
- while(_loc3_ < this.sideSpeed && this.mc._x < Stage.width - this.halfWidth)
- {
- this.mc._x = this.mc._x + 1;
- _loc3_ = _loc3_ + 1;
- }
- _root.checkPos();
- }
- function move()
- {
- if(this.dy == -1)
- {
- this.mc._y = _root.beam.leftBeam._y - this.mc._height / 2 - _root.beam.leftBeam._height / 2;
- }
- else if(this.mc._y >= Stage.height - this.mc._height / 2 - 5 && this.dy > 0)
- {
- this.dy = 0;
- this.mc._y = Stage.height - this.mc._height / 2;
- this.ffloor = true;
- }
- if(this.mc._y < Stage.height - this.mc._height / 2 - 5)
- {
- this.ffloor = false;
- }
- this.mc._y += this.dy;
- _root.checkPos();
- }
- function makePower()
- {
- var _loc2_ = new Color(this.mc.inside_mc);
- _loc2_.setRGB(52224);
- this.state = cBall.stPower;
- }
- function unmake()
- {
- if(this.state == cBall.stSize)
- {
- this.speed = _root.ballSpeed;
- }
- this.state = cBall.stNormal;
- this.mc._height = 0.7 * this.normHeight;
- this.mc._width = 0.7 * this.normWidth;
- this.halfWidth = Math.floor(this.mc._width / 2);
- var _loc3_ = new Color(this.mc.inside_mc);
- _loc3_.setRGB(this.col);
- }
- function makeSize()
- {
- this.state = cBall.stSize;
- this.mc._height = this.normHeight;
- this.mc._width = this.normWidth;
- this.halfWidth = Math.floor(this.mc._width / 2);
- }
- }
-