連続ダメージ forked from: alphabet
RPG戦闘風。適当ですみません
// forked from rsakane's alphabet
//RPG戦闘風。適当ですみません
package
{
/*
フォントサイズを固定、もしくは一定のサイズまでにした方が良かったかも
*/
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import org.libspark.betweenas3.BetweenAS3;
[SWF(width="465", height="465", frameRate="60", backgroundColor="0xF9F9F9")]
public class Main extends Sprite
{
private var data:Vector.<TextField> = new Vector.<TextField>();
private var frameCount:int = 0;
private var fontSize:int = 30;
private var tx:int = 0;
private var ty:int = 0;
private var pos:int = 0;
public function Main()
{
Wonderfl.capture_delay(10);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void
{
if (frameCount++ % 6 != 0) return;
if (frameCount >= 25)
{
removeChild(data[0]);
data[0] = null;
data.splice(0, 1);
removeChild(data[0]);
data[0] = null;
data.splice(0, 1);
}
tx %= 4;
tx++;
if (tx == 0) ty++
ty %= 10;
var num:uint = Math.random()*7000+5000;
if(num>9999) num = 9999;
var damage:String = String(num);
var char:String = damage.charAt(pos++ % damage.length);
var tf:TextField = new TextField();
tf.defaultTextFormat = new TextFormat("typeWriter_", fontSize, 0x0);
tf.text = char;
tf.x = tx * 20+200;
tf.y = ty * 50+250;
tf.autoSize = TextFieldAutoSize.LEFT;
addChild(tf);
var mask:TextField = new TextField();
mask.defaultTextFormat = new TextFormat("typeWriter_", fontSize, 0x0);
mask.text = char;
mask.x = tx * 20+200;
mask.y = ty * 50+250;
mask.visible = false;
mask.autoSize = TextFieldAutoSize.LEFT;
addChild(mask);
data.push(tf);
data.push(mask);
BetweenAS3.serial
(
BetweenAS3.tween(tf, { scaleX:1.0, scaleY:1.0 }, { scaleX:3.0, scaleY:3.0 }, 0.15),
BetweenAS3.tween(mask, { scaleX:2.0, scaleY:2.0, alpha:0 }, {visible:1 }, 0.2)
).play();
}
}
}