Wanco x Gainer 好き!!!
forked from Wanco x Gainer (diff: 44)
ActionScript3 source code
/**
* Copyright azuremous ( http://wonderfl.net/user/azuremous )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3N7W
*/
// forked from kotobuki's Wanco x Gainer
package {
import flash.utils.IDataInput;
import flash.utils.Timer;
import flash.display.Sprite;
import net.wonderfl.widget.Wanco;
import flash.utils.Timer;
import flash.events.TimerEvent;
import funnel.*;
import funnel.ui.*;
public class FlashTest extends Sprite {
private var gainer:Gainer;
private var wanco:Wanco;
private var timer:Timer;
private var sleepTimer:Timer;
private var count:int;
public function FlashTest() {
gainer = new Gainer();
wanco = new Wanco();
addChild(wanco);
wanco.x = 250;
wanco.y = 250;
gainer.button.addEventListener(ButtonEvent.PRESS, onButtonPress);
gainer.button.addEventListener(ButtonEvent.RELEASE, onButtonreleased);
timer = new Timer(1500, 0);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
sleepTimer = new Timer(1000, 1);
sleepTimer.addEventListener(TimerEvent.TIMER_COMPLETE, sleep);
//this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onButtonPress(e:ButtonEvent):void {
if(!timer.running){
timer.start();
wanco.wakeUp();
}else if(timer.running){ wanco.turn();
count = 0; }
if(sleepTimer.running){
sleepTimer.stop();
}
}
private function onButtonreleased(e:ButtonEvent):void {
wanco.heart();
}
private function onTimer(e:TimerEvent):void {
wanco.jump1();
count ++;
if(count == 5){
wanco.pout();
if (!sleepTimer.running) { sleepTimer.start(); } if (timer.running) { timer.stop(); }
}
}
private function sleep(e:TimerEvent):void { wanco.sleep(); }
}
}
