karate,jumping high forked from: Checkmate vol.5 Sponser
コードがひどいのは気にしないです
タイトル画面等入れる前に力尽きました
/**
* Copyright _ueueueueue ( http://wonderfl.net/user/_ueueueueue )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/5ico
*/
// forked from checkmate's Checkmate vol.5 Sponser
//コードがひどいのは気にしないです
//タイトル画面等入れる前に力尽きました
package {
import flash.display.*;
import flash.events.*;
import flash.media.Sound;
import flash.text.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import jp.progression.commands.*;
import jp.progression.commands.lists.*;
import jp.progression.commands.display.*;
import jp.progression.commands.net.*;
import jp.progression.commands.tweens.*;
import jp.progression.events.*;
import org.si.sion.*;
import org.si.sion.events.*;
import caurina.transitions.*;
[SWF(backgroundColor=0x0)]
public class Sponser extends Sprite {
public static var GRAPHICS_URL:String = "http://swf.wonderfl.net/static/assets/checkmate05/humanSponser.swf";
private var flyJumpMotion:MovieClip;
private var gameStage:GameStage = new GameStage();
private var d:SiONDriver = new SiONDriver();
private var openingMelody:SiONData;
private var endMelody:SiONData;
private var startFrame:int = 11;
private var finalFrame:int = 32;
public function Sponser() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
this.addChild(gameStage);
var mml1:String = "t60;v4[r1e16^32>b32<e32r32a16&a8&a32 d16a16b16<f8&f32&f16>e32d32b16^32e32b16^32<e32r32e8&e8]1;v2[r1>e16^32>b32<e32r32a16&a8&a32 d16a16b16<f8&f32&f16>e32d32b16^32e32b16^32<e32r32e8&e8]1;";
var mml2:String = "t180;v4[r8d8&d8>a16r32<d16r8g8&g4&g8d8>a8<d8d2]1;v2[r8>d8&d8>a16r32<d16r8g8&g4&g8d8>a8<d8d2]1;";
openingMelody = d.compile(mml1);
endMelody = d.compile(mml2);
opening();
var com:SerialList = new SerialList();
com.addCommand(
new LoadSWF( new URLRequest( GRAPHICS_URL ) ),
function():void {
var loader:Loader = Loader( this.latestData );
var domain:ApplicationDomain = loader.contentLoaderInfo.applicationDomain;
flyJumpMotion = new ( domain.getDefinition( "FlyMotion" ) as Class );
}
);
com.addEventListener(ExecuteEvent.EXECUTE_COMPLETE,onLoadSWF);
com.execute();
}
private function onLoadSWF(e:Event):void {
setMotion();
}
private function setMotion():void {
flyJumpMotion.stop();
flyJumpMotion.x = 50;
flyJumpMotion.y = -200;
flyJumpMotion.scaleX = -0.25;
flyJumpMotion.scaleY = 0.25;
flyJumpMotion.gotoAndStop(startFrame);
addChild(flyJumpMotion);
var m:Sprite = new Sprite();
m.graphics.beginFill(0xffffff);
m.graphics.drawRect(15, 45, 435, 365);
addChild(m);
flyJumpMotion.mask = m;
flyJumpMotion.addEventListener(Event.ENTER_FRAME, motionPlay);
}
private function motionPlay(e:Event):void {
flyJumpMotion.play();
flyJumpMotion.y += 2.0;
if (flyJumpMotion.y >= 545) {
flyJumpMotion.removeEventListener(Event.ENTER_FRAME, motionPlay);
removeChild(flyJumpMotion);
gameOver();
}
if (flyJumpMotion.currentFrame == finalFrame) {
flyJumpMotion.gotoAndPlay(startFrame);
}
}
private function clickHandler(e:Event):void {
var motion:MovieClip = e.currentTarget as MovieClip;
motion.gotoAndPlay(1);
}
private function delayRemove():void {
var t:Timer = new Timer(2700, 1);
t.start();
t.addEventListener(TimerEvent.TIMER, function(e:Event):void { removeChild(gameStage); addText() } );
}
private function addText():void {
var fmt:TextFormat = new TextFormat();
fmt.color = 0xffffff;
var tf:TextField = new TextField();
tf.defaultTextFormat = fmt;
tf.x = (stage.stageWidth-tf.width) / 2;
tf.y = stage.stageHeight / 2;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.text = "THE END";
this.addChild(tf);
}
private function opening():void {
d.play(openingMelody);
}
private function gameOver():void {
d.play(endMelody);
delayRemove();
}
}
}
import flash.display.*;
class GameStage extends Sprite {
private var container:Sprite;
private static const STAGE_WIDTH:int = 465;
private static const STAGE_HEIGHT:int = 465;
function GameStage() {
container = new Sprite();
addChild(container);
drawBg();
drawLocationGauge();
drawIcon();
drawSky();
drawSea();
drawGround();
drawWall(0xffffff,2);
drawWall(0x0,0);
}
private function drawBg():void {
var bg:Shape = new Shape();
bg.graphics.beginFill(0x0, 1.0);
bg.graphics.drawRect(0, 0, STAGE_WIDTH, STAGE_HEIGHT);
bg.graphics.beginFill(0x3CBAFA, 1.0);
bg.graphics.drawRect(15, 45, STAGE_WIDTH - 30, STAGE_HEIGHT - 60);
container.addChild(bg);
}
private function drawSky():void {
var sky:Shape = new Shape();
sky.graphics.beginFill(0xffffff);
sky.graphics.drawRect(15, 45, 435, 17);
sky.graphics.drawRect(15, 64, 435, 14);
sky.graphics.drawRect(15, 81, 435, 11);
sky.graphics.drawRect(15, 97, 435, 9);
sky.graphics.drawRect(15, 112, 435, 7);
sky.graphics.drawRect(15, 126, 435, 5);
sky.graphics.drawRect(15, 139, 435, 3);
sky.graphics.drawRect(15, 151, 435, 1);
container.addChild(sky);
}
private function drawLocationGauge():void {
var location:Shape = new Shape();
location.graphics.lineStyle(0, 0xC53467);
location.graphics.beginFill(0xffffff);
location.graphics.drawRect(15, 10, STAGE_WIDTH - 30, 10);
location.graphics.endFill();
container.addChild(location);
}
private function drawIcon():void {
var icon:Shape = new Shape();
icon.graphics.beginFill(0x0DB1666);
icon.graphics.drawRect(0, 0, 14, 14);
icon.graphics.beginFill(0xffffff);
icon.graphics.drawRect(3, 3, 8, 8);
icon.graphics.beginFill(0x740C35);
icon.graphics.drawRect(5, 5, 4, 4);
icon.graphics.endFill();
icon.x = (STAGE_WIDTH + icon.width) / 2;
icon.y = 8;
container.addChild(icon);
}
private function drawSea():void {
var sea:Shape = new Shape();
sea.graphics.beginFill(0x2009A0);
sea.graphics.drawRect(15, 350, STAGE_WIDTH - 30, 100);
sea.graphics.endFill();
container.addChild(sea);
}
private function drawWall(color:uint, offset:Number = 0):void {
var wall:Shape = new Shape();
wall.graphics.beginFill(color);
wall.graphics.drawRect(130, 282, 320 - offset, 83);
wall.graphics.drawRect(135, 254, 7, 28);
wall.graphics.drawRect(255, 254, 7, 28);
wall.graphics.drawRect(375, 254, 7, 28);
wall.graphics.drawRect(130, 265, 5, 7);
wall.graphics.drawRect(142, 265, 113, 7);
wall.graphics.drawRect(262, 265, 113, 7);
wall.graphics.drawRect(382, 265, 68-offset, 7);
wall.x = offset;
wall.y = -offset;
container.addChild(wall);
}
private function drawGround():void {
var shadow:Shape = new Shape();
shadow.graphics.beginFill(0x0);
shadow.graphics.moveTo(100, 375);
shadow.graphics.lineTo(95, 425);
shadow.graphics.lineTo(80, 425);
shadow.graphics.lineTo(75, 450);
shadow.graphics.lineTo(140, 450);
shadow.graphics.lineTo(140, 375);
container.addChild(shadow);
var ground:Shape = new Shape();
ground.graphics.beginFill(0x857503);
ground.graphics.moveTo(130, 365);
ground.graphics.curveTo(104, 368, 100, 375);
ground.graphics.curveTo(95, 385, 130, 395);
ground.graphics.curveTo(100, 410, 95, 412);
ground.graphics.curveTo(78, 422, 80, 425);
ground.graphics.curveTo(90, 445, 130, 450);
ground.graphics.lineTo(450, 450);
ground.graphics.lineTo(450, 365);
ground.graphics.lineTo(130, 365);
ground.graphics.endFill();
container.addChild(ground);
}
}