AndroidStar
Android Bot
/**
* Copyright Mr.Star ( http://wonderfl.net/user/Mr.Star )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/jNeK
*/
package
{
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.TimerEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.Timer;
import flash.display.CapsStyle;
import flash.display.Graphics;
import flash.display.JointStyle;
import flash.display.LineScaleMode;
import flash.events.Event;
[SWF(background="0x336699")]
public class Android extends Sprite
{
private var android:Shape = new Shape();
private var dstar:Shape = new Shape();
private var COLOR:uint;
private var radians:Number=0.8;
private var range:Number=.5;
private var speed:Number=0.2;
public function Android()
{
android.graphics.beginFill(0x97C024,1);
android.graphics.lineStyle(12,0x97c024,1,false,"normal","round","round",3);
android.graphics.moveTo(14,40);
android.graphics.lineTo(14,64);
android.graphics.moveTo(81,40);
android.graphics.lineTo(81,64);
android.graphics.moveTo(38,68);
android.graphics.lineTo(38,92);
android.graphics.moveTo(57,68);
android.graphics.lineTo(57,92);
android.graphics.moveTo(28,42);
android.graphics.lineTo(28,73);
android.graphics.lineTo(67,73);
android.graphics.lineTo(67,42);
android.graphics.lineStyle(2,0x97c024,1,false,"normal","round","round",3);
android.graphics.moveTo(32,5);
android.graphics.lineTo(37,15);
android.graphics.moveTo(64,5);
android.graphics.lineTo(58, 15);
android.graphics.lineStyle();
android.graphics.moveTo(22,35);
android.graphics.lineTo(73,35);
android.graphics.lineTo(73,45);
android.graphics.lineTo(22,45);
android.graphics.lineTo(22,35);
android.graphics.moveTo(22,33);
android.graphics.curveTo(22,21.38,29.97,15.56);
android.graphics.curveTo(37.94,9.75,47.5,9.75);
android.graphics.curveTo(57.06,9.75,65.03,15.56);
android.graphics.curveTo(73, 21.38, 73, 33);
//Eyes
android.graphics.beginFill(0xFFFFFF,1);
android.graphics.drawCircle(38,22,2);
android.graphics.drawCircle(57,22,2);
android.graphics.endFill();
android.graphics.lineStyle(4,0x97c024);
android.graphics.moveTo(27,45);
android.graphics.lineTo(68,45);
addChild(android);
this.scaleX = this.scaleY = 4;
this.x = 50;
dstar.graphics.lineStyle();
dstar.graphics.moveTo(15,0);
dstar.graphics.beginFill(0xFFFF00);
for (var i:int=1; i < 11; i++)
{
var radius2:Number=15;
if (i % 2 > 0)
{
radius2=15 / 2;
}
var angle:Number=Math.PI * 2 / 10 * i;
dstar.graphics.lineTo(Math.cos(angle) * radius2,Math.sin(angle) * radius2);
}
addChild(dstar);
dstar.x = 48;
dstar.y = 55;
dstar.rotation = -18;
// dstar.scaleX = dstar.scaleY = 1.5;
textFun();
drawHartL();
drawHartR();
}
private function drawHartL():void{
var hart:Sprite = new Sprite();
var g:Graphics = hart.graphics;
g.lineStyle(10,0xff0000,1.0,false,LineScaleMode.NORMAL,CapsStyle.ROUND,JointStyle.MITER);
g.moveTo(0,0);
g.lineTo(5,5);
g.lineTo(10,0);
addChild(hart);
hart.scaleX = hart.scaleY = .8;
hart.x = 33;
hart.y = 21;
// hart.addEventListener(Event.ENTER_FRAME,onJump);
}
private function drawHartR():void{
var hart:Sprite = new Sprite();
var g:Graphics = hart.graphics;
g.lineStyle(10,0xff0000,1.0,false,LineScaleMode.NORMAL,CapsStyle.ROUND,JointStyle.MITER);
g.moveTo(0,0);
g.lineTo(5,5);
g.lineTo(10,0);
addChild(hart);
hart.scaleX = hart.scaleY = .8;
hart.x= 54;
hart.y = 21;
//hart.addEventListener(Event.ENTER_FRAME,onJump);
}
private function onJump(e:Event):void{
e.target.scaleX = e.target.scaleY = .5+Math.sin(radians)*range;
radians+=speed;
}
private function textFun():void
{
COLOR = Math.random()*0XFFFFFF;
var tf:TextField = new TextField();
tf.text = "Mr.Star";
var tfm:TextFormat = new TextFormat();
tfm.bold = true;
tfm.color = COLOR;
//tfm.url = "http://xiaoshihoukelihaile.blogspot.com/";
tf.setTextFormat(tfm);
tf.selectable = false;
tf.x = 25;
tf.y = 64;
addChild(tf);
}
}
}