mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 01:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,119 @@
|
||||
package game.moatMadness
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.Sprite;
|
||||
import flash.geom.Point;
|
||||
import flash.geom.Rectangle;
|
||||
|
||||
public class FrameAnimation
|
||||
{
|
||||
|
||||
public var _container:Sprite;
|
||||
|
||||
private var _activeImage:Bitmap;
|
||||
|
||||
private var _totalFrames:int;
|
||||
|
||||
private var _frameWidth:int;
|
||||
|
||||
private var _frameHeight:int;
|
||||
|
||||
private var _frame:int;
|
||||
|
||||
private var _frameTime:Number;
|
||||
|
||||
private var _frameTimer:Number;
|
||||
|
||||
private var _imageFrames:Bitmap;
|
||||
|
||||
private var _loopFrame:int;
|
||||
|
||||
public function FrameAnimation(param1:Bitmap, param2:int, param3:int, param4:int, param5:int, param6:Number, param7:int = -1, param8:int = -1)
|
||||
{
|
||||
super();
|
||||
_container = new Sprite();
|
||||
_frameWidth = param4;
|
||||
_frameHeight = param5;
|
||||
_container.x = param2;
|
||||
_container.y = param3;
|
||||
_loopFrame = param8 - 1;
|
||||
_imageFrames = param1;
|
||||
var _loc9_:int = _imageFrames.width;
|
||||
var _loc10_:int = _imageFrames.height;
|
||||
_totalFrames = _loc9_ / _frameWidth * (_loc10_ / _frameHeight);
|
||||
if(param7 != -1 && param7 < _totalFrames)
|
||||
{
|
||||
_totalFrames = param7;
|
||||
}
|
||||
_frameTime = param6 / _totalFrames;
|
||||
_activeImage = new Bitmap();
|
||||
_activeImage.x = -_frameWidth / 2;
|
||||
_activeImage.y = -_frameHeight / 2;
|
||||
_container.addChild(_activeImage);
|
||||
setActiveFrame(0);
|
||||
}
|
||||
|
||||
public function heartbeat(param1:Number) : void
|
||||
{
|
||||
if(!atFrameEnd())
|
||||
{
|
||||
_frameTimer -= param1;
|
||||
if(_frameTimer <= 0)
|
||||
{
|
||||
setActiveFrame(_frame + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function atFrameEnd() : Boolean
|
||||
{
|
||||
return _frame >= _totalFrames;
|
||||
}
|
||||
|
||||
public function atNextToLastFrame(param1:int) : Boolean
|
||||
{
|
||||
return _frame >= _totalFrames - param1;
|
||||
}
|
||||
|
||||
private function setActiveFrame(param1:int) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc3_:Rectangle = null;
|
||||
var _loc6_:Point = null;
|
||||
var _loc4_:BitmapData = null;
|
||||
if(param1 >= _totalFrames)
|
||||
{
|
||||
if(_loopFrame >= 0)
|
||||
{
|
||||
param1 = _loopFrame;
|
||||
}
|
||||
}
|
||||
if(param1 < _totalFrames)
|
||||
{
|
||||
_loc2_ = _imageFrames.width;
|
||||
_loc9_ = _imageFrames.height;
|
||||
_loc5_ = _loc2_ / _frameWidth;
|
||||
_loc8_ = param1 % _loc5_;
|
||||
_loc7_ = param1 / _loc5_;
|
||||
_loc3_ = new Rectangle(_loc8_ * _frameWidth,_loc7_ * _frameHeight,_frameWidth,_frameHeight);
|
||||
_loc6_ = new Point(0,0);
|
||||
_loc4_ = new BitmapData(_frameWidth,_frameHeight);
|
||||
_loc4_.copyPixels(_imageFrames.bitmapData,_loc3_,_loc6_);
|
||||
_activeImage.bitmapData = _loc4_;
|
||||
_frame = param1;
|
||||
_frameTimer = _frameTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
_frame = _totalFrames;
|
||||
_frameTimer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,107 @@
|
||||
package game.moatMadness
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class MoatPath
|
||||
{
|
||||
|
||||
public var _theGame:MoatMadness;
|
||||
|
||||
public var _container:Sprite;
|
||||
|
||||
public var _width:int;
|
||||
|
||||
public var _height:int;
|
||||
|
||||
public var _targetRotation:Number;
|
||||
|
||||
public var _currentRotation:Number;
|
||||
|
||||
public var _nextFillDirection:int;
|
||||
|
||||
protected var _filling:Boolean;
|
||||
|
||||
public function MoatPath()
|
||||
{
|
||||
super();
|
||||
_container = new Sprite();
|
||||
_targetRotation = 0;
|
||||
_currentRotation = 0;
|
||||
_filling = false;
|
||||
}
|
||||
|
||||
public function init(param1:MoatMadness, param2:int, param3:int, param4:int) : void
|
||||
{
|
||||
_theGame = param1;
|
||||
_container.x = param2 + _width / 2;
|
||||
_container.y = param3 + _height / 2;
|
||||
_theGame._layerBackground.addChild(_container);
|
||||
_container.addEventListener("click",handleClick,false,0,true);
|
||||
_targetRotation = param4;
|
||||
_currentRotation = _targetRotation;
|
||||
_container.rotation = _targetRotation;
|
||||
}
|
||||
|
||||
public function Remove() : void
|
||||
{
|
||||
_container.removeEventListener("click",handleClick);
|
||||
_container.parent.removeChild(_container);
|
||||
_container = null;
|
||||
}
|
||||
|
||||
public function handleClick(param1:MouseEvent) : void
|
||||
{
|
||||
if(!_theGame._waterFilling && !_theGame._gameOver && !_theGame.getPaused())
|
||||
{
|
||||
if(_currentRotation == _targetRotation)
|
||||
{
|
||||
_targetRotation += 90;
|
||||
_theGame._soundMan.playByName(_theGame._soundNameRotate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function heartbeat(param1:Number) : void
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
if(_currentRotation != _targetRotation)
|
||||
{
|
||||
_loc2_ = 360 * param1;
|
||||
_currentRotation += _loc2_;
|
||||
if(_currentRotation >= _targetRotation)
|
||||
{
|
||||
_loc2_ -= _currentRotation - _targetRotation;
|
||||
if(_targetRotation >= 360)
|
||||
{
|
||||
_targetRotation -= 360;
|
||||
}
|
||||
_currentRotation = _targetRotation;
|
||||
}
|
||||
_container.rotation += _loc2_;
|
||||
}
|
||||
}
|
||||
|
||||
public function testForValidFill(param1:int, param2:int, param3:int) : Boolean
|
||||
{
|
||||
return param1 >= _container.x - _width / 2 && param1 <= _container.x + _width / 2 && param2 >= _container.y - _height / 2 && param2 <= _container.y + _height / 2;
|
||||
}
|
||||
|
||||
public function startFill(param1:int) : void
|
||||
{
|
||||
_filling = true;
|
||||
}
|
||||
|
||||
protected function setFull() : void
|
||||
{
|
||||
_filling = false;
|
||||
_theGame.pathFill(this,_nextFillDirection);
|
||||
}
|
||||
|
||||
public function getFillDirection(param1:int) : int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package game.moatMadness
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class MoatPathCross extends MoatPath
|
||||
{
|
||||
|
||||
private var _activeImage:Object;
|
||||
|
||||
private var _fillAnimationTop:FrameAnimation;
|
||||
|
||||
private var _fillAnimationBottom:FrameAnimation;
|
||||
|
||||
public function MoatPathCross(param1:MoatMadness)
|
||||
{
|
||||
super();
|
||||
_theGame = param1;
|
||||
var _loc2_:Object = _theGame.getScene().getLayer("piece_cross");
|
||||
_activeImage = _theGame.getScene().cloneAsset("piece_cross");
|
||||
_width = _loc2_.loader.width;
|
||||
_height = _loc2_.loader.height;
|
||||
_activeImage.loader.x = -_width / 2;
|
||||
_activeImage.loader.y = -_height / 2;
|
||||
}
|
||||
|
||||
override public function init(param1:MoatMadness, param2:int, param3:int, param4:int) : void
|
||||
{
|
||||
_container.addChild(_activeImage.loader);
|
||||
super.init(param1,param2,param3,param4);
|
||||
}
|
||||
|
||||
override public function Remove() : void
|
||||
{
|
||||
_container.removeChild(_activeImage.loader);
|
||||
if(_fillAnimationTop)
|
||||
{
|
||||
_fillAnimationTop._container.parent.removeChild(_fillAnimationTop._container);
|
||||
_fillAnimationTop = null;
|
||||
}
|
||||
if(_fillAnimationBottom)
|
||||
{
|
||||
_fillAnimationBottom._container.parent.removeChild(_fillAnimationBottom._container);
|
||||
_fillAnimationBottom = null;
|
||||
}
|
||||
super.Remove();
|
||||
}
|
||||
|
||||
override public function handleClick(param1:MouseEvent) : void
|
||||
{
|
||||
super.handleClick(param1);
|
||||
}
|
||||
|
||||
override public function heartbeat(param1:Number) : void
|
||||
{
|
||||
if(_fillAnimationTop && !_fillAnimationTop.atFrameEnd())
|
||||
{
|
||||
_fillAnimationTop.heartbeat(param1);
|
||||
if(_filling && _fillAnimationTop.atNextToLastFrame(5))
|
||||
{
|
||||
setFull();
|
||||
}
|
||||
}
|
||||
if(_fillAnimationBottom && !_fillAnimationBottom.atFrameEnd())
|
||||
{
|
||||
_fillAnimationBottom.heartbeat(param1);
|
||||
if(_filling && _fillAnimationBottom.atNextToLastFrame(5))
|
||||
{
|
||||
setFull();
|
||||
}
|
||||
}
|
||||
super.heartbeat(param1);
|
||||
}
|
||||
|
||||
override public function testForValidFill(param1:int, param2:int, param3:int) : Boolean
|
||||
{
|
||||
return super.testForValidFill(param1,param2,param3);
|
||||
}
|
||||
|
||||
override public function getFillDirection(param1:int) : int
|
||||
{
|
||||
return param1;
|
||||
}
|
||||
|
||||
override public function startFill(param1:int) : void
|
||||
{
|
||||
super.startFill(param1);
|
||||
_nextFillDirection = getFillDirection(param1);
|
||||
var _loc3_:Bitmap = _theGame.getScene().getLayer("fill_cross_top").loader.content as Bitmap;
|
||||
var _loc2_:Bitmap = _theGame.getScene().getLayer("fill_cross_bottom").loader.content as Bitmap;
|
||||
switch(param1 - 1)
|
||||
{
|
||||
case 0:
|
||||
if(_targetRotation == 0 || _targetRotation == 180)
|
||||
{
|
||||
_fillAnimationBottom = new FrameAnimation(_loc2_,_container.x,_container.y,100,100,0.5);
|
||||
_fillAnimationBottom._container.rotation = 180;
|
||||
_theGame._layerBackground.addChild(_fillAnimationBottom._container);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fillAnimationTop = new FrameAnimation(_loc3_,_container.x,_container.y,100,100,0.5);
|
||||
_fillAnimationTop._container.rotation = 90;
|
||||
_theGame._layerBackground.addChild(_fillAnimationTop._container);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(_targetRotation == 90 || _targetRotation == 270)
|
||||
{
|
||||
_fillAnimationBottom = new FrameAnimation(_loc2_,_container.x,_container.y,100,100,0.5);
|
||||
_fillAnimationBottom._container.rotation = 270;
|
||||
_theGame._layerBackground.addChild(_fillAnimationBottom._container);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fillAnimationTop = new FrameAnimation(_loc3_,_container.x,_container.y,100,100,0.5);
|
||||
_fillAnimationTop._container.rotation = 180;
|
||||
_theGame._layerBackground.addChild(_fillAnimationTop._container);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(_targetRotation == 0 || _targetRotation == 180)
|
||||
{
|
||||
_fillAnimationBottom = new FrameAnimation(_loc2_,_container.x,_container.y,100,100,0.5);
|
||||
_theGame._layerBackground.addChild(_fillAnimationBottom._container);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fillAnimationTop = new FrameAnimation(_loc3_,_container.x,_container.y,100,100,0.5);
|
||||
_fillAnimationTop._container.rotation = 270;
|
||||
_theGame._layerBackground.addChild(_fillAnimationTop._container);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(_targetRotation == 90 || _targetRotation == 270)
|
||||
{
|
||||
_fillAnimationBottom = new FrameAnimation(_loc2_,_container.x,_container.y,100,100,0.5);
|
||||
_fillAnimationBottom._container.rotation = 90;
|
||||
_theGame._layerBackground.addChild(_fillAnimationBottom._container);
|
||||
break;
|
||||
}
|
||||
_fillAnimationTop = new FrameAnimation(_loc3_,_container.x,_container.y,100,100,0.5);
|
||||
_fillAnimationTop._container.rotation = 0;
|
||||
_theGame._layerBackground.addChild(_fillAnimationTop._container);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
package game.moatMadness
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class MoatPathCurve extends MoatPath
|
||||
{
|
||||
|
||||
private var _activeImage:Object;
|
||||
|
||||
private var _fillAnimation:FrameAnimation;
|
||||
|
||||
public function MoatPathCurve(param1:MoatMadness)
|
||||
{
|
||||
super();
|
||||
_theGame = param1;
|
||||
var _loc2_:Object = _theGame.getScene().getLayer("piece_curve");
|
||||
_activeImage = _theGame.getScene().cloneAsset("piece_curve");
|
||||
_width = _loc2_.loader.width;
|
||||
_height = _loc2_.loader.height;
|
||||
_activeImage.loader.x = -_width / 2;
|
||||
_activeImage.loader.y = -_height / 2;
|
||||
}
|
||||
|
||||
override public function init(param1:MoatMadness, param2:int, param3:int, param4:int) : void
|
||||
{
|
||||
_container.addChild(_activeImage.loader);
|
||||
super.init(param1,param2,param3,param4);
|
||||
}
|
||||
|
||||
override public function Remove() : void
|
||||
{
|
||||
_container.removeChild(_activeImage.loader);
|
||||
if(_fillAnimation)
|
||||
{
|
||||
_fillAnimation._container.parent.removeChild(_fillAnimation._container);
|
||||
_fillAnimation = null;
|
||||
}
|
||||
super.Remove();
|
||||
}
|
||||
|
||||
override public function handleClick(param1:MouseEvent) : void
|
||||
{
|
||||
super.handleClick(param1);
|
||||
}
|
||||
|
||||
override public function heartbeat(param1:Number) : void
|
||||
{
|
||||
if(_fillAnimation && !_fillAnimation.atFrameEnd())
|
||||
{
|
||||
_fillAnimation.heartbeat(param1);
|
||||
if(_filling && _fillAnimation.atNextToLastFrame(5))
|
||||
{
|
||||
setFull();
|
||||
}
|
||||
}
|
||||
super.heartbeat(param1);
|
||||
}
|
||||
|
||||
override public function testForValidFill(param1:int, param2:int, param3:int) : Boolean
|
||||
{
|
||||
if(super.testForValidFill(param1,param2,param3))
|
||||
{
|
||||
return param3 == 1 && (_targetRotation == 180 || _targetRotation == 270) || param3 == 3 && (_targetRotation == 0 || _targetRotation == 90) || param3 == 2 && (_targetRotation == 0 || _targetRotation == 270) || param3 == 4 && (_targetRotation == 90 || _targetRotation == 180);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
override public function getFillDirection(param1:int) : int
|
||||
{
|
||||
switch(param1 - 1)
|
||||
{
|
||||
case 0:
|
||||
if(_targetRotation == 180)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 4;
|
||||
break;
|
||||
case 1:
|
||||
if(_targetRotation == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 3;
|
||||
break;
|
||||
case 2:
|
||||
if(_targetRotation == 0)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
return 2;
|
||||
break;
|
||||
case 3:
|
||||
if(_targetRotation == 90)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 3;
|
||||
break;
|
||||
default:
|
||||
return param1;
|
||||
}
|
||||
}
|
||||
|
||||
override public function startFill(param1:int) : void
|
||||
{
|
||||
super.startFill(param1);
|
||||
_nextFillDirection = getFillDirection(param1);
|
||||
var _loc2_:Object = _theGame.getScene().getLayer("fill_curve_1").loader;
|
||||
var _loc4_:Object = _theGame.getScene().getLayer("fill_curve_2").loader;
|
||||
var _loc3_:Bitmap = _loc2_.content as Bitmap;
|
||||
var _loc5_:Bitmap = _loc4_.content as Bitmap;
|
||||
switch(param1 - 1)
|
||||
{
|
||||
case 0:
|
||||
if(_targetRotation == 180)
|
||||
{
|
||||
_fillAnimation = new FrameAnimation(_loc3_,_container.x,_container.y,100,100,0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fillAnimation = new FrameAnimation(_loc5_,_container.x,_container.y,100,100,0.5);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(_targetRotation == 0)
|
||||
{
|
||||
_fillAnimation = new FrameAnimation(_loc5_,_container.x,_container.y,100,100,0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fillAnimation = new FrameAnimation(_loc3_,_container.x,_container.y,100,100,0.5);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(_targetRotation == 0)
|
||||
{
|
||||
_fillAnimation = new FrameAnimation(_loc3_,_container.x,_container.y,100,100,0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fillAnimation = new FrameAnimation(_loc5_,_container.x,_container.y,100,100,0.5);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(_targetRotation == 90)
|
||||
{
|
||||
_fillAnimation = new FrameAnimation(_loc3_,_container.x,_container.y,100,100,0.5);
|
||||
break;
|
||||
}
|
||||
_fillAnimation = new FrameAnimation(_loc5_,_container.x,_container.y,100,100,0.5);
|
||||
}
|
||||
_fillAnimation._container.rotation = _targetRotation;
|
||||
_theGame._layerBackground.addChild(_fillAnimation._container);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package game.moatMadness
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class MoatPathStraight extends MoatPath
|
||||
{
|
||||
|
||||
private var _activeImage:Object;
|
||||
|
||||
private var _fillAnimation:FrameAnimation;
|
||||
|
||||
public function MoatPathStraight(param1:MoatMadness)
|
||||
{
|
||||
super();
|
||||
_theGame = param1;
|
||||
var _loc2_:Object = _theGame.getScene().getLayer("piece_straight");
|
||||
_activeImage = _theGame.getScene().cloneAsset("piece_straight");
|
||||
_width = _loc2_.loader.width;
|
||||
_height = _loc2_.loader.height;
|
||||
_activeImage.loader.x = -_width / 2;
|
||||
_activeImage.loader.y = -_height / 2;
|
||||
}
|
||||
|
||||
override public function init(param1:MoatMadness, param2:int, param3:int, param4:int) : void
|
||||
{
|
||||
_container.addChild(_activeImage.loader);
|
||||
super.init(param1,param2,param3,param4);
|
||||
}
|
||||
|
||||
override public function Remove() : void
|
||||
{
|
||||
_container.removeChild(_activeImage.loader);
|
||||
if(_fillAnimation)
|
||||
{
|
||||
_fillAnimation._container.parent.removeChild(_fillAnimation._container);
|
||||
_fillAnimation = null;
|
||||
}
|
||||
super.Remove();
|
||||
}
|
||||
|
||||
override public function handleClick(param1:MouseEvent) : void
|
||||
{
|
||||
super.handleClick(param1);
|
||||
}
|
||||
|
||||
override public function heartbeat(param1:Number) : void
|
||||
{
|
||||
if(_fillAnimation && !_fillAnimation.atFrameEnd())
|
||||
{
|
||||
_fillAnimation.heartbeat(param1);
|
||||
if(_filling && _fillAnimation.atNextToLastFrame(5))
|
||||
{
|
||||
setFull();
|
||||
}
|
||||
}
|
||||
super.heartbeat(param1);
|
||||
}
|
||||
|
||||
override public function testForValidFill(param1:int, param2:int, param3:int) : Boolean
|
||||
{
|
||||
if(super.testForValidFill(param1,param2,param3))
|
||||
{
|
||||
return param3 == 1 && (_targetRotation == 0 || _targetRotation == 180) || param3 == 3 && (_targetRotation == 0 || _targetRotation == 180) || param3 == 2 && (_targetRotation == 90 || _targetRotation == 270) || param3 == 4 && (_targetRotation == 90 || _targetRotation == 270);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
override public function getFillDirection(param1:int) : int
|
||||
{
|
||||
return param1;
|
||||
}
|
||||
|
||||
override public function startFill(param1:int) : void
|
||||
{
|
||||
super.startFill(param1);
|
||||
_nextFillDirection = getFillDirection(param1);
|
||||
var _loc2_:Bitmap = _theGame.getScene().getLayer("fill_straight").loader.content as Bitmap;
|
||||
_fillAnimation = new FrameAnimation(_loc2_,_container.x,_container.y,100,100,0.5);
|
||||
switch(param1 - 1)
|
||||
{
|
||||
case 0:
|
||||
_fillAnimation._container.rotation = 180;
|
||||
break;
|
||||
case 1:
|
||||
_fillAnimation._container.rotation = 270;
|
||||
break;
|
||||
case 2:
|
||||
_fillAnimation._container.rotation = 0;
|
||||
break;
|
||||
case 3:
|
||||
_fillAnimation._container.rotation = 90;
|
||||
}
|
||||
_theGame._layerBackground.addChild(_fillAnimation._container);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user