Rabbit2
/**
* Copyright hacker_cobulht0 ( http://wonderfl.net/user/hacker_cobulht0 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/frdd
*/
package {
import flash.display.Sprite;
import flash.events.*;
[SWF(width = "465", height = "465", backgroundColor = 0xffcccc, frameRate = "60")]
public class Rabbit2 extends Sprite{
public function Rabbit2(){if (stage) init();else addEventListener(Event.ADDED_TO_STAGE,init );}
public function init(ev:Event = null){
removeEventListener( Event.ADDED_TO_STAGE, init ) ;
stage.addEventListener(MouseEvent.MOUSE_DOWN, clicks);
}
private function clicks(ev){
var mc:drawRabi=new drawRabi(mouseY);
mc.x=mouseX;
mc.y=mouseY;
addChild(mc);
mc.addEventListener(Event.ENTER_FRAME, escapes);
}
private function escapes(ev){
var _rabi:Sprite=ev.target;
var _face:Sprite=new Sprite;
var speedx:Number = 5*ev.target._ea[0];
var sita:uint=ev.target._sita;
var rad:Number=Math.PI/180;
if(ev.target._cd>360){
_face.graphics.beginFill(0xffffff);
_face.graphics.drawEllipse(3,-12,15,15);
_face.graphics.drawCircle(ev.target._ea[1],10,4);
_face.graphics.beginFill(0xcc4d40);
_face.graphics.drawCircle(ev.target._ea[2],-5,1.2);
_face.graphics.endFill();
ev.target.addChild(_face);
ev.target.speedy+=15;
ev.target.y=30*Math.sin(ev.target.speedy*rad)+sita;
ev.target.x+=speedx;
if(ev.target.x<0||ev.target.x>465){
_rabi.removeEventListener(Event.ENTER_FRAME, escapes);
removeChild(_rabi);
_rabi=null;
}
}else{ev.target._cd++;}
}
}
}
import flash.display.Sprite;
import flash.filters.GlowFilter;
import caurina.transitions.Tweener;
class drawRabi extends Sprite{
private var myArray0:Array=["_body","_head","_ear1","_ear2"];
private var myArray1:Array=[0,3,4,12];//_x
private var myArray2:Array=[0,-12,-20,-20];//_y
private var myArray3:Array=[20,15,5,5];//_width
private var myArray4:Array=[20,15,10,10];//_height
private var myArrayE:Array=[[1,0,13],[-1,20,8]];//EscapeArray
public var _array:Array;
public var _cd:uint;
public var _ea:Array;
public var _sita:uint;
public var speedy:uint;
public function drawRabi(arg:uint){
var _pointX:uint=0;
var _pointY:uint=0;
_array=new Array();
_cd=0;
_ea=myArrayE[Math.floor (Math.random () * 2)];
_sita=arg;
speedy=0;
for(var j:int=0; j < 4; j++)
{
var rb_sp:Sprite = new Sprite();
rb_sp.graphics.beginFill(0xffffff);
rb_sp.graphics.drawEllipse(0,0, myArray3[j], myArray4[j]);
if(j==1){
rb_sp.graphics.beginFill(0xcc4d40);
rb_sp.graphics.drawCircle(4,5,1.2);
rb_sp.graphics.drawCircle(10,5,1.2);
rb_sp.graphics.drawCircle(7,9,1.7);
}
rb_sp.graphics.endFill();
filters = [ new GlowFilter( 0xff9999, 0.5, 40, 40, 5 ) ] ;
//しっかり入れとくこと
rb_sp.x=_pointX+myArray1[j];
rb_sp.y=_pointY+myArray2[j];
//------------------------------------------------------------------------
if(j==0){
rb_sp.y=_pointY;
rb_sp.scaleY=0;
Tweener.addTween(rb_sp, {scaleY:1,y:_pointY+myArray2[0]-30,time:0.4,transition:"easeOutBack"});
Tweener.addTween(rb_sp, {y:_pointY+myArray2[0],time:0.8,delay:0.4,transition:"easeOutBounce" });
}
if(j==1){
rb_sp.y=_pointY+10;
rb_sp.scaleY=0;
Tweener.addTween(rb_sp, {scaleY:1,y:_pointY+myArray2[1],time:1.5,delay:1.2,transition:"easeOutElastic"});
}
if(j==2){
rb_sp.y=_pointY+10;
rb_sp.scaleY=0;
Tweener.addTween(rb_sp, {scaleY:1,y:_pointY+myArray2[2],time:1.5,delay:1.3,transition:"easeOutElastic"});
}
if(j==3){
rb_sp.y=_pointY+10;
rb_sp.scaleY=0;
Tweener.addTween(rb_sp, {scaleY:1,y:_pointY+myArray2[3],time:1.5,delay:1.4,transition:"easeOutElastic"});
}
//------------------------------------------------------------------------
rb_sp.name=myArray0[j];
_array.push(rb_sp);
this.addChild(rb_sp);
}
}
}