mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27: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
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,429 @@
|
||||
package game.touchPool
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public class TouchPoolCreature
|
||||
{
|
||||
|
||||
public static const TYPE_HORSESHOECRAB:int = 0;
|
||||
|
||||
public static const TYPE_RAY:int = 1;
|
||||
|
||||
public static const TYPE_SEASLUG:int = 2;
|
||||
|
||||
public static const TYPE_HERMITCRAB:int = 3;
|
||||
|
||||
public static const TYPE_STARFISH:int = 4;
|
||||
|
||||
public static const TYPE_URCHIN:int = 5;
|
||||
|
||||
public static const ROTATION_RATE:Number = 8;
|
||||
|
||||
public static var RAYSPEEDLOW:int = 100;
|
||||
|
||||
public static var RAYSPEEDHIGH:int = 140;
|
||||
|
||||
public static var RAYSPEEDFLEE:int = 240;
|
||||
|
||||
public static var HSCRABSPEEDLOW:int = 80;
|
||||
|
||||
public static var HSCRABSPEEDHIGH:int = 120;
|
||||
|
||||
public static var HSCRABSPEEDFLEE:int = 190;
|
||||
|
||||
public static var SLUGSPEEDLOW:int = 5;
|
||||
|
||||
public static var SLUGSPEEDHIGH:int = 15;
|
||||
|
||||
public static var SLUGSPEEDFLEE:int = 35;
|
||||
|
||||
public static var HERMITSPEEDLOW:int = 10;
|
||||
|
||||
public static var HERMITSPEEDHIGH:int = 25;
|
||||
|
||||
private var _theGame:TouchPool;
|
||||
|
||||
public var _clone:Object;
|
||||
|
||||
public var _type:int;
|
||||
|
||||
public var _color:int;
|
||||
|
||||
private var _speed:Number;
|
||||
|
||||
private var _currentSpeed:Number;
|
||||
|
||||
private var _rippleTimer:int;
|
||||
|
||||
private var _fleeTimer:Number;
|
||||
|
||||
private var _thinkTimer:Number;
|
||||
|
||||
private var _creature_rotation:Number;
|
||||
|
||||
private var _angleToMouse:Number;
|
||||
|
||||
private var _currentPoint:int;
|
||||
|
||||
public var _wake:Array;
|
||||
|
||||
private var _currentWakeIndex:int;
|
||||
|
||||
public var _content:MovieClip;
|
||||
|
||||
private var _scaleFactorWakeSpread:Number;
|
||||
|
||||
private var _numWakes:int;
|
||||
|
||||
private var _wakeScaleFactor:int;
|
||||
|
||||
public var _spawnIndex:int;
|
||||
|
||||
public function TouchPoolCreature(param1:TouchPool)
|
||||
{
|
||||
super();
|
||||
_theGame = param1;
|
||||
}
|
||||
|
||||
public static function getLogIndexFromType(param1:int) : int
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case 0:
|
||||
return 4;
|
||||
case 1:
|
||||
return 2;
|
||||
case 2:
|
||||
return 5;
|
||||
case 3:
|
||||
return 1;
|
||||
case 4:
|
||||
return 6;
|
||||
case 5:
|
||||
return 3;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getTypeFromLogIndex(param1:int) : int
|
||||
{
|
||||
switch(param1 - 1)
|
||||
{
|
||||
case 0:
|
||||
return 3;
|
||||
case 1:
|
||||
return 1;
|
||||
case 2:
|
||||
return 5;
|
||||
case 3:
|
||||
return 0;
|
||||
case 4:
|
||||
return 2;
|
||||
case 5:
|
||||
return 4;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getFactIndexFromType(param1:int) : int
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case 0:
|
||||
return 1;
|
||||
case 1:
|
||||
return 5;
|
||||
case 2:
|
||||
return 2;
|
||||
case 3:
|
||||
return 0;
|
||||
case 4:
|
||||
return 3;
|
||||
case 5:
|
||||
return 4;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public function getNumGems() : int
|
||||
{
|
||||
switch(_type)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return 7;
|
||||
case 2:
|
||||
case 3:
|
||||
return 5;
|
||||
case 4:
|
||||
case 5:
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getTouchTime() : int
|
||||
{
|
||||
switch(_type)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return 4;
|
||||
case 2:
|
||||
case 3:
|
||||
return 3;
|
||||
case 4:
|
||||
case 5:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function setSpeed() : void
|
||||
{
|
||||
switch(_type)
|
||||
{
|
||||
case 0:
|
||||
_speed = Math.random() * Math.abs(HSCRABSPEEDHIGH - HSCRABSPEEDLOW) + HSCRABSPEEDLOW;
|
||||
break;
|
||||
case 1:
|
||||
_speed = Math.random() * Math.abs(RAYSPEEDHIGH - RAYSPEEDLOW) + RAYSPEEDLOW;
|
||||
break;
|
||||
case 2:
|
||||
_speed = Math.random() * Math.abs(SLUGSPEEDHIGH - SLUGSPEEDLOW) + SLUGSPEEDLOW;
|
||||
break;
|
||||
case 3:
|
||||
_speed = Math.random() * Math.abs(HERMITSPEEDHIGH - HERMITSPEEDLOW) + HERMITSPEEDLOW;
|
||||
break;
|
||||
case 4:
|
||||
}
|
||||
}
|
||||
|
||||
public function setWakeSpread() : void
|
||||
{
|
||||
_wakeScaleFactor = 1;
|
||||
switch(_type)
|
||||
{
|
||||
case 0:
|
||||
_scaleFactorWakeSpread = 1;
|
||||
_numWakes = 4;
|
||||
_wakeScaleFactor = 1.35;
|
||||
break;
|
||||
case 1:
|
||||
_scaleFactorWakeSpread = 3;
|
||||
_numWakes = 4;
|
||||
_wakeScaleFactor = 2.3;
|
||||
break;
|
||||
case 2:
|
||||
_scaleFactorWakeSpread = 1;
|
||||
_numWakes = 6;
|
||||
_wakeScaleFactor = 1.6;
|
||||
}
|
||||
}
|
||||
|
||||
public function getFleeSpeed() : int
|
||||
{
|
||||
switch(_type)
|
||||
{
|
||||
case 0:
|
||||
return HSCRABSPEEDFLEE;
|
||||
case 1:
|
||||
return RAYSPEEDFLEE;
|
||||
case 2:
|
||||
return SLUGSPEEDFLEE;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function init(param1:int, param2:int, param3:int, param4:Boolean) : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
_thinkTimer = 0;
|
||||
_type = param1;
|
||||
_clone = _theGame.getScene().getLayer("c" + (param1 * 2 + (param4 ? 0 : 1)));
|
||||
_content = _clone.loader.content;
|
||||
switch(param1)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
setSpeed();
|
||||
break;
|
||||
case 2:
|
||||
setSpeed();
|
||||
_thinkTimer = 10;
|
||||
break;
|
||||
case 3:
|
||||
setSpeed();
|
||||
_content.walk();
|
||||
}
|
||||
if(_content.hasOwnProperty("init"))
|
||||
{
|
||||
_content.init();
|
||||
}
|
||||
_currentSpeed = _speed;
|
||||
_clone.loader.x = param2;
|
||||
_clone.loader.y = param3;
|
||||
_color = Math.floor(Math.random() * 5) + 1;
|
||||
_content.changeColor(_color);
|
||||
_currentPoint = Math.floor(Math.random() * _theGame._poolPoints.length);
|
||||
setWakeSpread();
|
||||
if(param1 < 3)
|
||||
{
|
||||
_wake = [];
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _numWakes)
|
||||
{
|
||||
_wake[_loc5_] = GETDEFINITIONBYNAME("tierneyPool_wake");
|
||||
if(param1 == 2)
|
||||
{
|
||||
_wake[_loc5_].alpha = 0.2;
|
||||
}
|
||||
_wake[_loc5_].scaleX = _wake[_loc5_].scaleY = _wakeScaleFactor;
|
||||
_loc5_++;
|
||||
}
|
||||
_currentWakeIndex = 0;
|
||||
}
|
||||
_creature_rotation = 0;
|
||||
_angleToMouse = 0;
|
||||
_rippleTimer = 0;
|
||||
}
|
||||
|
||||
public function heartbeat(param1:Number) : void
|
||||
{
|
||||
var _loc7_:Number = NaN;
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc6_:Number = NaN;
|
||||
var _loc4_:int = 0;
|
||||
var _loc2_:Object = null;
|
||||
if(_type <= 3)
|
||||
{
|
||||
_loc7_ = Number(_theGame._poolPoints[_currentPoint].x);
|
||||
_loc3_ = Number(_theGame._poolPoints[_currentPoint].y);
|
||||
_loc5_ = _creature_rotation * (3.141592653589793 / 180);
|
||||
_angleToMouse = Math.atan2(_loc3_ - _clone.loader.y,_loc7_ - _clone.loader.x);
|
||||
_loc6_ = Math.atan2(Math.sin(_angleToMouse - _loc5_),Math.cos(_angleToMouse - _loc5_));
|
||||
_creature_rotation += Math.max(Math.min(180 / 3.141592653589793 * _loc6_,8),-8);
|
||||
_loc5_ = _creature_rotation * (3.141592653589793 / 180);
|
||||
_content.creature.rotation = _creature_rotation + 90;
|
||||
_clone.loader.x += Math.cos(_loc5_) * _currentSpeed * param1;
|
||||
_clone.loader.y += Math.sin(_loc5_) * _currentSpeed * param1;
|
||||
if((_clone.loader.x - _loc7_) * (_clone.loader.x - _loc7_) + (_clone.loader.y - _loc3_) * (_clone.loader.y - _loc3_) < 3000)
|
||||
{
|
||||
_currentPoint = Math.floor(Math.random() * _theGame._poolPoints.length);
|
||||
}
|
||||
if(_fleeTimer > 0)
|
||||
{
|
||||
_fleeTimer -= param1;
|
||||
}
|
||||
if(_thinkTimer > 0)
|
||||
{
|
||||
_thinkTimer -= param1;
|
||||
if(_thinkTimer <= 0)
|
||||
{
|
||||
_thinkTimer = 10;
|
||||
if(_speed == 0)
|
||||
{
|
||||
setSpeed();
|
||||
}
|
||||
else if(_speed != SLUGSPEEDFLEE && Math.random() < 0.5)
|
||||
{
|
||||
_speed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _theGame._ripple.length)
|
||||
{
|
||||
if(_theGame._ripple[_loc4_].width > 0 && (_clone.loader.x - _theGame._ripple[_loc4_].x) * (_clone.loader.x - _theGame._ripple[_loc4_].x) + (_clone.loader.y - _theGame._ripple[_loc4_].y) * (_clone.loader.y - _theGame._ripple[_loc4_].y) < Math.pow(_clone.width + _theGame._ripple[_loc4_].width,2) * 0.25)
|
||||
{
|
||||
if(_type == 3)
|
||||
{
|
||||
_loc2_ = GETDEFINITIONBYNAME("tierneyPool_dustCloud");
|
||||
_theGame._dustClouds.push(_loc2_);
|
||||
_theGame._soundMan.playByName(_theGame._soundNamePoof);
|
||||
_loc2_.dustOn();
|
||||
_loc2_.x = _clone.loader.x + _content.creature.x;
|
||||
_loc2_.y = _clone.loader.y + _content.creature.y;
|
||||
_theGame._layerGems.addChild(_loc2_ as DisplayObject);
|
||||
_currentPoint += Math.floor(Math.random() * _theGame._poolPoints.length) + 1;
|
||||
_currentPoint %= _theGame._poolPoints.length;
|
||||
_clone.loader.x = _theGame._poolPoints[_currentPoint].x;
|
||||
_clone.loader.y = _theGame._poolPoints[_currentPoint].y;
|
||||
}
|
||||
else if(_currentSpeed != getFleeSpeed())
|
||||
{
|
||||
_currentSpeed = getFleeSpeed();
|
||||
_content.walk();
|
||||
_rippleTimer = 0;
|
||||
}
|
||||
_fleeTimer = 3;
|
||||
break;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
if(_fleeTimer <= 0)
|
||||
{
|
||||
if(_currentSpeed != _speed)
|
||||
{
|
||||
_currentSpeed = _speed;
|
||||
_rippleTimer = 0;
|
||||
_content.idle();
|
||||
}
|
||||
}
|
||||
if(_type != 3)
|
||||
{
|
||||
if(_rippleTimer == 0)
|
||||
{
|
||||
_rippleTimer = getRippleTime();
|
||||
_wake[_currentWakeIndex].rotation = _creature_rotation + 90;
|
||||
_wake[_currentWakeIndex].x = _clone.loader.x + (_content.hasOwnProperty("creature") ? _content.creature.x : 0);
|
||||
_wake[_currentWakeIndex].y = _clone.loader.y + (_content.hasOwnProperty("creature") ? _content.creature.y : 0);
|
||||
_wake[_currentWakeIndex].gotoAndPlay(2);
|
||||
_currentWakeIndex = _currentWakeIndex + 1;
|
||||
if(_currentWakeIndex >= _wake.length)
|
||||
{
|
||||
_currentWakeIndex = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_rippleTimer -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_content.hasOwnProperty("creatureRotation"))
|
||||
{
|
||||
_content.creatureRotation(null);
|
||||
}
|
||||
}
|
||||
|
||||
private function getRippleTime() : int
|
||||
{
|
||||
return Math.max(Math.floor(450 * _scaleFactorWakeSpread / _currentSpeed),1);
|
||||
}
|
||||
|
||||
public function setRotation(param1:Number) : void
|
||||
{
|
||||
_content.creature.rotation = param1;
|
||||
}
|
||||
|
||||
public function changeColor(param1:int) : void
|
||||
{
|
||||
_content.changeColor(param1);
|
||||
}
|
||||
|
||||
public function removeEvents() : void
|
||||
{
|
||||
_content.removeEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
package game.touchPool
|
||||
{
|
||||
public class TouchPoolData
|
||||
{
|
||||
|
||||
internal static const _audio:Array = ["aj_gem_new.mp3","tp_cd4sec.mp3","tp_gemBurst.mp3","tp_gemCollision1.mp3","tp_gemCollision2.mp3","tp_gemCollision3.mp3","tp_loggedStinger.mp3","tp_poof.mp3","tp_popUpEnter.mp3","tp_popUpExit.mp3","tp_popupSuccess.mp3","tp_rolloverCountDown.mp3","tp_tileSelect.mp3","tp_inMenuRollover.mp3","hud_exitRollover.mp3","hud_exitSelect.mp3"];
|
||||
|
||||
public var _facts:Array;
|
||||
|
||||
public function TouchPoolData()
|
||||
{
|
||||
super();
|
||||
_facts = [{
|
||||
"imageID":1300,
|
||||
"title":11933,
|
||||
"text":11903
|
||||
},{
|
||||
"imageID":1301,
|
||||
"title":11933,
|
||||
"text":11904
|
||||
},{
|
||||
"imageID":1302,
|
||||
"title":11933,
|
||||
"text":11905
|
||||
},{
|
||||
"imageID":1303,
|
||||
"title":11933,
|
||||
"text":11906
|
||||
},{
|
||||
"imageID":1304,
|
||||
"title":11933,
|
||||
"text":11907
|
||||
},{
|
||||
"imageID":1305,
|
||||
"title":11934,
|
||||
"text":11908
|
||||
},{
|
||||
"imageID":1306,
|
||||
"title":11934,
|
||||
"text":11909
|
||||
},{
|
||||
"imageID":1307,
|
||||
"title":11934,
|
||||
"text":11910
|
||||
},{
|
||||
"imageID":1308,
|
||||
"title":11934,
|
||||
"text":11911
|
||||
},{
|
||||
"imageID":1309,
|
||||
"title":11934,
|
||||
"text":11912
|
||||
},{
|
||||
"imageID":1310,
|
||||
"title":11935,
|
||||
"text":11913
|
||||
},{
|
||||
"imageID":1311,
|
||||
"title":11935,
|
||||
"text":11914
|
||||
},{
|
||||
"imageID":1312,
|
||||
"title":11935,
|
||||
"text":11915
|
||||
},{
|
||||
"imageID":1313,
|
||||
"title":11935,
|
||||
"text":11916
|
||||
},{
|
||||
"imageID":1314,
|
||||
"title":11935,
|
||||
"text":11917
|
||||
},{
|
||||
"imageID":1315,
|
||||
"title":11936,
|
||||
"text":11918
|
||||
},{
|
||||
"imageID":1316,
|
||||
"title":11936,
|
||||
"text":11919
|
||||
},{
|
||||
"imageID":1317,
|
||||
"title":11936,
|
||||
"text":11920
|
||||
},{
|
||||
"imageID":1318,
|
||||
"title":11936,
|
||||
"text":11921
|
||||
},{
|
||||
"imageID":1319,
|
||||
"title":11936,
|
||||
"text":11922
|
||||
},{
|
||||
"imageID":1320,
|
||||
"title":11937,
|
||||
"text":11923
|
||||
},{
|
||||
"imageID":1321,
|
||||
"title":11937,
|
||||
"text":11924
|
||||
},{
|
||||
"imageID":1322,
|
||||
"title":11937,
|
||||
"text":11925
|
||||
},{
|
||||
"imageID":1323,
|
||||
"title":11937,
|
||||
"text":11926
|
||||
},{
|
||||
"imageID":1324,
|
||||
"title":11937,
|
||||
"text":11927
|
||||
},{
|
||||
"imageID":1325,
|
||||
"title":11938,
|
||||
"text":11928
|
||||
},{
|
||||
"imageID":1326,
|
||||
"title":11938,
|
||||
"text":11929
|
||||
},{
|
||||
"imageID":1327,
|
||||
"title":11938,
|
||||
"text":11930
|
||||
},{
|
||||
"imageID":1328,
|
||||
"title":11938,
|
||||
"text":11931
|
||||
},{
|
||||
"imageID":1329,
|
||||
"title":11938,
|
||||
"text":11932
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package game.touchPool
|
||||
{
|
||||
public class TouchPoolGem
|
||||
{
|
||||
|
||||
private static const LIFETIME:int = 8;
|
||||
|
||||
public var _clone:Object;
|
||||
|
||||
public var _lifeTimer:Number;
|
||||
|
||||
public var _collected:Boolean;
|
||||
|
||||
private var _theGame:TouchPool;
|
||||
|
||||
public function TouchPoolGem(param1:TouchPool)
|
||||
{
|
||||
super();
|
||||
_theGame = param1;
|
||||
_clone = GETDEFINITIONBYNAME("tierneyPool_gem");
|
||||
}
|
||||
|
||||
public function reset() : void
|
||||
{
|
||||
_lifeTimer = 8;
|
||||
_collected = false;
|
||||
_clone.visible = true;
|
||||
}
|
||||
|
||||
public function heartbeat(param1:Number) : void
|
||||
{
|
||||
_lifeTimer -= param1;
|
||||
if(_lifeTimer < 3 && !_collected)
|
||||
{
|
||||
if(Math.floor(_lifeTimer * 10) % 2 == 0)
|
||||
{
|
||||
_clone.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_clone.visible = true;
|
||||
}
|
||||
}
|
||||
if(_lifeTimer <= 0)
|
||||
{
|
||||
if(_clone.parent)
|
||||
{
|
||||
_clone.parent.removeChild(_clone);
|
||||
}
|
||||
}
|
||||
if(_clone.bounceSound)
|
||||
{
|
||||
_clone.bounceSound = false;
|
||||
_theGame._soundMan.playByName(_theGame["_soundNameGemCollision" + (Math.floor(Math.random() * 3) + 1)]);
|
||||
}
|
||||
}
|
||||
|
||||
public function collect() : void
|
||||
{
|
||||
_collected = true;
|
||||
_clone.collect();
|
||||
_clone.visible = true;
|
||||
_lifeTimer = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user