forked from: テトリステスト
♥0 |
Line 61 |
Modified 2009-08-06 07:13:09 |
MIT License
archived:2017-03-20 04:10:05
ActionScript3 source code
/**
* Copyright maxpop ( http://wonderfl.net/user/maxpop )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pjBL
*/
// forked from otoyasumi's テトリステスト
package {
import flash.display.Sprite;
import flash.events.*;
public class Tetrimino extends Sprite {
public const SIZE:int = 30;
/**
* kind list
*/
public static const kinds:Array = [I, J, L, O, S, T, Z, WALL];
public static const I:String = "I";
public static const J:String = "J";
public static const L:String = "L";
public static const O:String = "O";
public static const S:String = "S";
public static const T:String = "T";
public static const Z:String = "Z";
public static const WALL:String = "WALL";
/**
* color list
*/
public static const colorList:Object = {
I : 0x00ffff,
J : 0x0000ff,
L : 0xff9900,
O : 0xffff00,
S : 0xff0000,
T : 0xff00ff,
Z : 0x00ff00,
WALL : 0x808080
};
private var _kind:String;
private var _color:int;
public var boxes:Array;
public var x:int = 3;
public var y:int = 0;
public var angle:int = 0;
public function get kind():String { return _kind };
public function get color():int { return _color };
public function Tetrimino(_king:String) {
this._kind = _kind;
this._color = colorList[_kind];
angle = 0;
boxes = new Array();
initBoxes();
ChangeWatcher.watch(this, 'angle', function(e:PropertyChangeEvent):void
{
var diff:int = (e.newValue as int) - (e.oldValue as int);
if(diff > 0)
{
while(diff > 0)
{
internalRotate(true);
diff--;
}
}
else
{
while(diff < 0)
{
internalRotate(false);
diff++;
}
}
});
}
}
}