mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09: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,80 @@
|
||||
package game.candyCatcher
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
|
||||
public class CandyCatchObject
|
||||
{
|
||||
|
||||
public static const CANDYTYPE_CANDY:int = 0;
|
||||
|
||||
public static const CANDYTYPE_TRASH:int = 1;
|
||||
|
||||
public static const CANDYTYPE_GOLD:int = 2;
|
||||
|
||||
private var MIN_FALL_SPEED:int = 50;
|
||||
|
||||
private var MAX_FALL_SPEED:int = 175;
|
||||
|
||||
public var _candy:MovieClip;
|
||||
|
||||
public var _type:int;
|
||||
|
||||
public var _fallSpeed:Number;
|
||||
|
||||
public function CandyCatchObject(param1:int, param2:int, param3:int, param4:Sprite)
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
super();
|
||||
_candy = GETDEFINITIONBYNAME("candyCatch_object");
|
||||
_type = param1;
|
||||
switch(_type - 1)
|
||||
{
|
||||
case 0:
|
||||
_loc5_ = Math.random() * 5 + 1;
|
||||
_candy.gotoAndStop("trash" + _loc5_);
|
||||
MIN_FALL_SPEED = 350;
|
||||
MAX_FALL_SPEED = 500;
|
||||
break;
|
||||
case 1:
|
||||
_candy.gotoAndStop("gold");
|
||||
MIN_FALL_SPEED = 300;
|
||||
MAX_FALL_SPEED = 500;
|
||||
break;
|
||||
default:
|
||||
_loc5_ = Math.random() * 5 + 1;
|
||||
_candy.gotoAndStop("candy" + _loc5_);
|
||||
MIN_FALL_SPEED = 200;
|
||||
MAX_FALL_SPEED = 500;
|
||||
}
|
||||
_candy.x = param2 + Math.random() * (param3 - param2);
|
||||
_candy.y = -_candy.height;
|
||||
_fallSpeed = MIN_FALL_SPEED + Math.random() * (MAX_FALL_SPEED - MIN_FALL_SPEED);
|
||||
param4.addChild(_candy);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_candy != null)
|
||||
{
|
||||
if(_candy.parent != null)
|
||||
{
|
||||
_candy.parent.removeChild(_candy);
|
||||
}
|
||||
_candy = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function heartbeat(param1:Number) : Boolean
|
||||
{
|
||||
_candy.rotation += 10 * _fallSpeed / MAX_FALL_SPEED;
|
||||
_candy.y += _fallSpeed * param1;
|
||||
if(_candy.y >= 550 + _candy.height)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user