forked from: 雑魚ゲー
実はゲームになってません。
Mouseで移動
Zで攻撃
Xでジャンプ
MRSSつかってみました。いろんなところで戦えます。
雑魚絵は友人作成です。
死亡演出追加
2010/08/27 by fooilman(登録ミス)
初めてのfork,AS3ですからコード書く練習用です。
温かい目で見守ってやってください。
/**
* Copyright fooilsh_man ( http://wonderfl.net/user/fooilsh_man )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/fmFZ
*/
// forked from kuma360's 雑魚ゲー
//実はゲームになってません。
//
//Mouseで移動
//Zで攻撃
//Xでジャンプ
//
//MRSSつかってみました。いろんなところで戦えます。
//雑魚絵は友人作成です。
//
//死亡演出追加
//
//2010/08/27 by fooilman(登録ミス)
//初めてのfork,AS3ですからコード書く練習用です。
//温かい目で見守ってやってください。
//
package
{
import flash.display.*;
import flash.events.*;
import flash.geom.ColorTransform;
import flash.net.URLRequest;
import flash.system.LoaderContext;
[SWF(frameRate='60')]
public class Main extends Sprite
{
private var _canvas:BitmapData = null ;
private var _key:Array = null ;
private var _mainHero:Hero = null ;
private var _h:Vector.<Hero> = null ;
private var _effect:Effect = null ;
private var _back:MRSS = null ;
////////////////////////////////////
public function Main() {
//キャンバス用意
_canvas = new BitmapData ( stage.stageWidth , stage.stageHeight , false , 0 ) ;
addChild ( new Bitmap ( _canvas ) ) ;
//背景用
_back = new MRSS ;
//キャラクター用
_h = new Vector.<Hero>;
//ヒットマーク用
_effect = new Effect ;
//キャラクタ画像読み込み
var L:Loader = new Loader;
L.contentLoaderInfo.addEventListener ( Event.COMPLETE, compLoad ) ;
L.contentLoaderInfo.addEventListener ( IOErrorEvent.IO_ERROR , function ():void { } ) ;
L.load ( new URLRequest ( FILENAME ) , new LoaderContext ( true ) ) ;
}
////////////////////////////////////
private function compLoad( e:Event ):void {
var B:Bitmap = e.target.content as Bitmap ;
_mainHero = new Hero ( B ) ;
_h.push ( _mainHero ) ;
_h.push ( new Hero ( B , new ColorTransform ( 1 , .2 , .2 , 1 ) ) ) ;
_h.push ( new Hero ( B , new ColorTransform ( .2 , .2 , 1 , 1 ) ) ) ;
_h.push ( new Hero ( B , new ColorTransform ( .2 , 1 , .2 , 1 ) ) ) ;
_h.push ( new Hero ( B , new ColorTransform ( 0 , 0 , 0 , .5 ) ) ) ;
//入力用
_key = new Array ( 256 ) ;
for ( var I:int = 0; I < 256; ++I ) { _key[I] = false; }
// stage.addEventListener( KeyboardEvent.KEY_DOWN, function ( $E:KeyboardEvent ):void { _key[ $E.keyCode ] = true; } );
// stage.addEventListener( KeyboardEvent.KEY_UP , function ( $E:KeyboardEvent ):void { _key[ $E.keyCode ] = false; } );
stage.addEventListener( KeyboardEvent.KEY_DOWN, KeyDownFunc );//function ( $E:KeyboardEvent ):void { _key[ $E.keyCode ] = true; } );
stage.addEventListener( KeyboardEvent.KEY_UP , KeyUpFunc );//function ( $E:KeyboardEvent ):void { _key[ $E.keyCode ] = false; } );
addEventListener ( Event.ENTER_FRAME , run ) ;
}
////////////////////////////////////
// キーボードが押されたときに呼び出されるイベント
// 分けた方が拡張しやすい
private function KeyDownFunc(event:KeyboardEvent):void{
_key[ event.keyCode ] = true;
}
// キーボードが離されたときに呼び出されるイベント
// 分けた方が拡張しやすい
private function KeyUpFunc(event:KeyboardEvent):void{
_key[ event.keyCode ] = false;
}
////////////////////////////////////
private function run ( e:Event ):void {
var TH1:Hero ;
var TH2:Hero ;
//背景
_back.render ( _canvas ) ;
//入力
for each ( TH1 in _h ) {
if ( TH1 == _mainHero ) {
_mainHero.input ( mouseX , mouseY , _key ) ;
// _mainHero.input ( mouseX, mouseY, _key[90],_key[88],_key[87],_key[84] );
} else {
TH1.inputAuto() ;
}
}
//更新
for each ( TH1 in _h ) {
TH1.update () ;
}
//攻撃判定
for each ( TH1 in _h ) {
for each ( TH2 in _h ) {
TH1.attackChk ( TH2 , _effect ) ;
}
}
//移動判定
for each ( TH1 in _h ) {
for each ( TH2 in _h ) {
TH1.moveChk ( TH2 ) ;
}
}
//影描画
for each ( TH1 in _h ) {
TH1.render_shadow ( _canvas ) ;
}
//描画
_h.sort ( function ( A:Hero , B:Hero ) :Number { return A.z - B.z ; } ) ;
for each ( TH1 in _h ) {
TH1.render ( _canvas ) ;
}
_effect.update () ;
_effect.render ( _canvas ) ;
}
}
}
import flash.display.*;
import flash.geom.*;
import flash.events.Event;
import flash.filters.BlurFilter;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.system.LoaderContext;
class MRSS {
//landscape
private const _feed:String = "http://api.flickr.com/services/feeds/photos_public.gne?tags=grass,plain&format=rss_200";
private const _media:Namespace = new Namespace ( "http://search.yahoo.com/mrss/" ) ;
private var _length:uint = 0 ;
private var _cnt:int = 0 ;
private var _V:Vector.<BitmapData> = new Vector.<BitmapData> ;
private var _now:BitmapData = null ;
////////////////////////////////////
public function MRSS() {
_cnt = 60 * 5 ;
var s:Sprite = new Sprite ;
var G:Graphics = s.graphics ;
G.beginFill ( 0x91ACCE , 1 ) ; G.drawRect ( 0 , 0 , 465 , ZMAX ) ; G.endFill () ;
G.beginFill ( 0x75D36D , 1 ) ; G.drawRect ( 0 , ZMAX , 465 , 465 ) ; G.endFill () ;
_now = new BitmapData ( 465 , 465 , false , 0 ) ;
_now.draw ( s ) ;
/*
var ldr:URLLoader = new URLLoader;
ldr.addEventListener ( Event.COMPLETE, function _load(e:Event):void {
ldr.removeEventListener(Event.COMPLETE, _load);
Loaded ( XML(ldr.data).._media::thumbnail.@url.toXMLString().split('\n') );
} );
ldr.load ( new URLRequest ( _feed ) ) ;
*/
}
////////////////////////////////////
private function Loaded ( $images:Array ) :void {
_length = $images.length ;
for ( var i:int = 0; i < _length ; ++i ) {
var ldr:Loader;
ldr = new Loader;
ldr.contentLoaderInfo.addEventListener ( Event.COMPLETE , Loadcomp ) ;
var strArray:String = $images[ i ].replace ( "_s" , "" ) ;
ldr.load ( new URLRequest ( strArray ) , new LoaderContext ( true ) ) ;
}
}
////////////////////////////////////
private function Loadcomp ( e:Event ) :void {
var data:Bitmap = e.target.content as Bitmap ;
if ( data ) {
var m:Matrix = new Matrix;
m.scale ( 465 / data.width , 465 / data.height ) ;
var b:BitmapData = new BitmapData ( 465 , 465 , false , 0 ) ;
b.draw ( data , m ) ;
_V.push ( b ) ;
}
}
////////////////////////////////////
public function render ( canvas:BitmapData ) :void {
if ( 60 * 5 < ++ _cnt && _V.length ) {
_cnt = 0 ;
_now = _V [ Math.floor ( Math.random() * _V.length ) ] ;
}
canvas.copyPixels ( _now , _now.rect , ZERO_POINT ) ;
}
}
class Effect {
private var _img:BitmapData = null ;
private var _V:Vector.<Object> = new Vector.<Object> ;
////////////////////////////////////
public function Effect() {
_img = new BitmapData ( 50 , 50 , true , 0 ) ;
var S:Sprite = new Sprite ;
var G:Graphics = S.graphics ;
var M:Matrix = new Matrix ;
M.createGradientBox ( 50 , 50 , 0 , 0 , 0 ) ;
G.lineStyle ( 1 ) ;
G.lineGradientStyle ( "radial" , [ 0xFFFFFF , 0xFFA020 ] , [ 1 , 0 ] , [ 0 , 255 ] , M ) ;
for ( var I:int = 0 ; I < 50 ; ++ I ) {
G.moveTo ( 25 , 25 ) ;
var R:Number = I / 50 * 360 * Math.PI / 180 ;
G.lineTo ( Math.cos ( R ) * 25 + 25 , Math.sin ( R ) * 25 + 25 ) ;
}
S.filters = [ new BlurFilter ] ;
_img.draw ( S ) ;
}
////////////////////////////////////
public function push ( x:int , y:int ) :void {
_V.push ( { P:new Point ( x - _img.width * .5 , y - _img.height * 1.5 ) , T:6 } ) ;
}
////////////////////////////////////
public function update () :void {
for ( var I:int = 0 ; I < _V.length ; ++ I ) {
if ( -- _V[I].T < 0 ) {
_V.splice ( I , 1 ) ;
}
}
}
////////////////////////////////////
public function render ( canvas:BitmapData ) :void {
for each ( var O:Object in _V ) {
canvas.copyPixels ( _img , _img.rect , O.P ) ;
}
}
}
class Hero {
//キャラクタのスケール
private const SCALE:Number = 1.5 ;
//キャラクタの実サイズ
private const SIZE :int = 64 * SCALE ;
//ユニークID管理
private static var _UNIQUE:int = 0 ;
private var _id:int = 0 ;
//体力
private var _hp:int = 0 ;
private var _hpmax:int = 0;// 遊びで追加
private var _death:Boolean = false ;
private var _death_cnt:int = 0;
//画像
private var _img:BitmapData = null ;
private var _img_r:BitmapData = null ;
private var _shadow:BitmapData = null ;
//アニメーション用
private var _animrect:Rectangle = null ;
private var _animwait:int = 0 ;
private var _anim:int = 0 ;
private var _action:int = 0 ;
private var _actionstep:int = 0 ;
private var _dirc:Boolean = false;
//移動用
private var _speed:Number = 0 ;
private var _target_x:int = 0 ;
private var _target_z:int = 0 ;
private var _pos:Vector3D = null ;
private var _velocity:Vector3D = null ;
//描画用
private var _renderpos:Point = null ;
private var _shadowpos:Point = null ;
//入力用
private var _input_damage:Boolean = false ;
private var _input_attack:Boolean = false ;
private var _input_jump :Boolean = false ;
private var _input_waza :Boolean = false ;// 遊びで追加
private var _input_charge:Boolean = false ;// 遊びで追加
//ジャンプ管理
private var _jump_state:Boolean = false;
//攻撃管理
private var _attack_state:int = 0 ;
private var _attack_shake:int = 0 ;
private var _hitRegist:Vector.<int> = null ;
private var _beemhit:int = 0; // 遊びで追加
private var _chargehit:int = 0; // 遊びで追加
//被ダメージ管理
private var _damage_action:int = 0 ;
private var _damage_shake:int = 0 ;
////////////////////////////////////
public function Hero ( B:Bitmap , C:ColorTransform = null ) {
_id = ++ _UNIQUE ;
var M:Matrix = new Matrix ;
var S:Sprite = new Sprite;
var G:Graphics = S.graphics;
var I:int = 0 ;
var J:int = 0 ;
var S1:Number = 30 * SCALE ;
var S2:Number = 12 * SCALE ;
var S3:Number = B.width * SCALE ;
var S4:Number = B.height * SCALE ;
//スケーリング
M.scale ( SCALE , SCALE ) ;
//影
G.beginFill ( 0 , .5 ) ;
G.drawEllipse ( 0 , 0 , S1 , S2 ) ;
G.endFill () ;
_shadow = new BitmapData ( S1 , S2 , true , 0 ) ;
_shadow.draw ( S ) ;
//キャラクタ-
_img = new BitmapData ( S3 , S4 , true , 0 ) ;
_img.draw ( B , M , C ) ;
//反転キャラクター
_img_r = new BitmapData ( S3 , S4 , true , 0 ) ;
for ( I = 0 ; I < S3 ; I += SIZE ) {
for ( J = 0 ; J < SIZE ; ++ J ) {
_img_r.copyPixels (
_img ,
new Rectangle ( I + J , 0 , 1 , S4 ) ,
new Point ( I + SIZE - J , 0 )
) ;
}
}
//
_renderpos = new Point ;
_shadowpos = new Point ;
_velocity = new Vector3D ;
_pos = new Vector3D ( Math.random()*465 , 0 , Math.random() * 100 + 300 ) ;
_animrect = new Rectangle ( 0 , 0 , SIZE , SIZE ) ;
_hitRegist = new Vector.<int> ;
//
_target_x = Math.random() * 400;
_target_z = 300 + Math.random() * 150;
//
_hp = 10 ;
_hpmax = _hp;
_death = false ;
_death_cnt = 0 ;
}
////////////////////////////////////
public function get z():Number {
return _pos.z;
}
////////////////////////////////////
//public function input ( x:int , y:int , keyA:Boolean , keyJ:Boolean , keyW:Boolean, keyC:Boolean ):void {
//*
public function input ( x:int , y:int , key:Array ):void {
_input_waza = key[87] ;// W
_input_attack = key[90] ;// Z
_input_jump = key[88] ;// X
_input_charge = key[84] ;// T
/*/
/*
_input_waza = keyW ;// W
_input_attack = keyA ;// Z
_input_jump = keyJ ;// X
_input_charge = keyC ;// T
//*/
_target_x = x ;
_target_z = y ;
}
////////////////////////////////////
public function inputAuto ( ):void {
_input_attack = Math.random() < 0.01 ;
_input_jump = Math.random() < 0.01 ;
var V:Vector3D = _pos.clone() ;
V.x -= _target_x ;
V.z -= _target_z ;
if ( V.length < 20 * SCALE ) {
_target_x = Math.random() * 465 ;
_target_z = Math.random() * 120 + 300 ;
}
}
////////////////////////////////////
public function update ( ):void {
var CHK:Boolean = true ;
var TC:int = $C[_action][_actionstep] ;
var Ba:int = _action;
var Bas:int = _actionstep;
var X:Number = 0 ;
var Y:Number = 0 ;
var L:Number = 0 ;
if ( _death ) {
if ( 60 < ++ _death_cnt ) {
_hp = 10 ;
_death = false ;
_death_cnt = 0 ;
_pos.y = - 300 ;
_velocity.y = 0 ;
_action = 12 ;
}
}
if ( 0 < _damage_shake ) {
CHK = false ;
-- _damage_shake ;
}
if ( 0 < _attack_shake ) {
CHK = false ;
-- _attack_shake ;
}
{//入力の反映
if ( 1 & TC ) {
X = _pos.x - _target_x ;
Y = _pos.z - _target_z ;
L = X * X + Y * Y ;
_action = ( 10 * 10 < L )? 1 : 0 ;
}
if ( 2 & TC ) {
if ( _input_attack ) {
if ( _jump_state ) {
_action = 6 ;
} else {
switch ( _attack_state ) {
case 0 : _attack_state = 1 ; _action = 3 ; break ;
case 1 : _attack_state = 2 ; _action = 7 ; break ;
case 2 : _attack_state = 0 ; _action = 4 ; break ;
}
}
} else if ( _input_waza ) {
_action = 13;
} else if ( _input_charge ) {
_action = 14;
} else {
_attack_state = 0 ;
}
}
if ( 4 & TC ) {
if ( _input_jump ) {
_action = 2 ;
}
}
//強制動作
if ( _damage_action ) {
_action = _damage_action ;
_damage_action = 0 ;
}
if ( Ba != _action ) {
_actionstep = 0 ;
_animwait = 0 ;
}
}
if ( CHK )
{//アニメーション
var TD:int = $D[_action][_actionstep];
switch ( TD ) {
case 0 :
++ _animwait;
break ;
case 1 :
if ( 0 < _velocity.y ) {
++ _animwait ;
}
break ;
case 2:
if ( false == _jump_state ) {
++ _animwait ;
}
break;
}
if ( $B[_action][_actionstep] <= _animwait ) {
//ビームも初期化
_beemhit = 0;
_animwait = 0 ;
switch ( $E[_action][_actionstep] ) {
case 1: _velocity.y = -5 ; break;
case 2: _action = 0 ; break ;
default: break;
}
if ( $A[_action].length <= ++ _actionstep ) {
_actionstep = 0 ;
}
while ( _hitRegist.length ) {
_hitRegist.pop () ;
}
//必殺技ビーム的な
} else if ( _action == 13 && _actionstep == 1 ) {
_beemhit += 10;
}
}
if ( CHK && ( 1 & TC ) )
{//加速
_dirc = ( _target_x < _pos.x ) ;
var ty:Number = _velocity.y;
_velocity.y = 0 ;
X = ( _target_x - _pos.x ) ;
Y = ( _target_z - _pos.z ) ;
L = X * X + Y * Y ;
if ( 10 * 10 < L ) {
_velocity.x += X * .01 ;
_velocity.z += Y * .01 ;
}
_speed = _velocity.length ;
_speed = ( 2 < _speed )? 2 : _speed ;
_velocity.normalize ( ) ;
_velocity.scaleBy ( _speed ) ;
_velocity.y = ty ;
}
if ( CHK )
{//移動
_pos.x += _velocity.x * SCALE ;
_pos.y += _velocity.y * SCALE ;
_pos.z += _velocity.z * SCALE *.5 ;
_velocity.y += .2 ;
if ( false == _jump_state ) {
_velocity.x *= .9 ;
_velocity.z *= .9 ;
}
if ( 0 <= _pos.y ) {
_pos.y = 0 ;
_jump_state = false ;
} else {
_jump_state = true ;
}
if ( _pos.z < ZMAX ) {
_pos.z = ZMAX ;
}
}
_anim = $A[_action][_actionstep] ;
}
////////////////////////////////////
public function attackChk ( e:Hero , effect:Effect ):void {
if ( this == e ) {
return ;
}
if ( e._death ) {
return ;
}
for each ( var N:int in _hitRegist ) {
if ( N == e._id ) {
return ;
}
}
//普通の攻撃判定
var temp:int = $F[_action][_actionstep] ;
if ( temp != 0 ) {
var V:Vector3D = _pos.subtract ( e._pos ) ;
switch( _action ){
case 13:
if ( _dirc ) {
V.x -= _beemhit;
} else {
V.x += _beemhit;
}
if ( V.length < 30 ) {
hit(e, effect,V,-3);
}
break;
case 14:
if ( _dirc ) {
V.x -= _beemhit;
} else {
V.x += _beemhit;
}
if ( V.length < 30 ) {
hit(e, effect,V,-5);
}
break;
default:
if ( _dirc ) {
V.x -= 16 * SCALE ;
} else {
V.x += 16 * SCALE ;
}
if ( V.length < 30 ) {
hit(e, effect,V,-1);
}
break;
}
}
}
private function hit( e:Hero , effect:Effect, V:Vector3D, damege:int):void{
e._hp += damege;
//技によって色々変化するはずだから一緒にしない方がいいけど面倒だから外し
_attack_shake = 10 ;
_hitRegist.push ( e._id ) ;
//死亡チェック
if ( e._hp <= 0 ) {
e._death = true ;
e._death_cnt = 0 ;
e._damage_action = 11 ;
} else {
e._damage_action = (e._jump_state)? 11 : ( 8 + Math.floor ( Math.random() * 3 ) ) ;
}
//ノックバック
e._velocity.x = (_dirc)? -1 : 1 ;
e._damage_shake = 15 ;
effect.push ( e._pos.x , e._pos.z + e._pos.y ) ;
}
////////////////////////////////////
public function moveChk ( e:Hero ):void {
if ( this == e ) {
return ;
}
var V:Vector3D = _pos.subtract ( e._pos ) ;
if ( V.length < 20 * SCALE ) {
V.normalize();
_velocity.x = V.x * 1 ;
_velocity.z = V.z * 1 ;
}
}
////////////////////////////////////
public function render_shadow ( canvas:BitmapData ):void {
_shadowpos.x = _pos.x - 15 * SCALE ;
_shadowpos.y = _pos.z - 7 * SCALE ;
canvas.copyPixels ( _shadow , _shadow.rect , _shadowpos ) ;
}
////////////////////////////////////
public function render ( canvas:BitmapData ):void {
if ( _death ) {
if ( _death_cnt % 10 < 5 ) {
return ;
}
}
_anim %= 40 ;
_animrect.x = Math.floor ( _anim % 8 ) * SIZE ;
_animrect.y = Math.floor ( _anim / 8 ) * SIZE ;
_renderpos.x = _pos.x - SIZE /2 ;
_renderpos.y = _pos.z + _pos.y - SIZE ;
if ( _damage_shake ) {
_renderpos.x += Math.random() * 10 - 5 ;
_renderpos.y += Math.random() * 10 - 5 ;
}
if ( _dirc ) {
canvas.copyPixels ( _img_r , _animrect , _renderpos ) ;
} else {
canvas.copyPixels ( _img , _animrect , _renderpos ) ;
}
//ビーム描画
if ( _action == 13 ) {
if ( _dirc ) {
// canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+30, _beemhit, 30), 0xffffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+30, _beemhit, 2), 0x00ffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+32, _beemhit, 2), 0x33ffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+34, _beemhit, 2), 0x66ffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+36, _beemhit, 2), 0x99ffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+38, _beemhit, 2), 0xccffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+40, _beemhit, 10), 0xffffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+50, _beemhit, 2), 0xccffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+52, _beemhit, 2), 0x99ffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+54, _beemhit, 2), 0x66ffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+56, _beemhit, 2), 0x33ffff );
canvas.fillRect(new Rectangle(_renderpos.x - _beemhit, _renderpos.y+58, _beemhit, 2), 0x00ffff );
} else {
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+30, _beemhit, 2), 0x00ffff );
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+32, _beemhit, 2), 0x33ffff );
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+34, _beemhit, 2), 0x66ffff );
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+36, _beemhit, 2), 0x99ffff );
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+38, _beemhit, 2), 0xccffff );
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+40, _beemhit, 10), 0xffffff );
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+50, _beemhit, 2), 0xccffff );
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+52, _beemhit, 2), 0x99ffff );
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+54, _beemhit, 2), 0x66ffff );
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+56, _beemhit, 2), 0x33ffff );
canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+58, _beemhit, 2), 0x00ffff );
// canvas.fillRect(new Rectangle(_renderpos.x+90, _renderpos.y+30, _beemhit, 30), 0xffffff );
}
}
//ライフポイント表示
canvas.fillRect(new Rectangle(_renderpos.x, _renderpos.y, 10 * _hpmax, 10), 0xff0000 );
canvas.fillRect(new Rectangle(_renderpos.x, _renderpos.y, 10 * _hp, 10), 0x00ff00 );
}
}
////////////////////////////////////
const FILENAME:String = "http://assets.wonderfl.net/images/related_images/a/a7/a79f/a79f6550f46ab03e548ec7fee72569ee99b89823" ;
const ZERO_POINT:Point = new Point ( 0 , 0 ) ;
const ZMAX:int = 300 ;
//アニメパターン
const $A:Array = [
[ 0 , 1 , 2 , 3 ] , //歩く
[ 32 , 33 , 34 , 35 , 36 , 37 ] , //走る
[ 4 , 5 , 6 , 7 , 4 ] , //飛ぶ
[ 8 , 9 ] , //パンチ
[ 10 , 11 , 12 ] , //強いパンチ
[ 13 , 4 ] , //ジャンプパンチ
[ 14 , 4 ] , //ジャンプキック
[ 29 , 15 ] , //キック
[ 16 ] , //弱ダメージ
[ 17 ] , //中ダメージ
[ 18 ] , //強ダメージ
[ 19 , 20 , 21 , 22 , 22 ] , //ダウン
[ 7 , 4 ], //落下
[ 8 , 9 ], //技
[ 8 , 8, 10 , 11, 12 ]//技チャージ
];
//ウェイト
const $B:Array = [
[ 8 , 8 , 8 , 8 ] , //歩く
[ 5 , 5 , 5 , 5 , 5 , 5 ] , //走る
[ 2 , 2 , 5 , 2 , 5 ] , //飛ぶ
[ 9 , 9 ] , //パンチ
[ 7, 7, 8 ] , //強いパンチ
[ 2 , 5 ] , //ジャンプパンチ
[ 2 , 5 ] , //ジャンプキック
[ 3 , 6 ] , //キック
[ 15 ] , //弱ダメージ
[ 15 ] , //中ダメージ
[ 15 ] , //強ダメージ
[ 9 , 9 , 9 , 9 , 99 ] , //ダウン
[ 2 , 5 ], //落下
[ 9 , 99 ], //技
[ 50, 100, 7, 7, 30 ] //チャージ技
] ;
//入力の許可 1=移動 + 2=攻撃 + 4=ジャンプ
const $C:Array = [
[ 7 , 7 , 7 , 7 ] , //歩く
[ 7 , 7 , 7 , 7 , 7 , 7 ] , //走る
[ 0 , 2 , 2 , 2 , 0 ] , //飛ぶ
[ 0 , 0 ] , //パンチ
[ 0 , 0 , 0 ] , //強いパンチ
[ 0 , 0 ] , //ジャンプパンチ
[ 0 , 0 ] , //ジャンプキック
[ 0 , 0 ] , //キック
[ 0 ] , //弱ダメージ
[ 0 ] , //中ダメージ
[ 0 ] , //強ダメージ
[ 0 , 0 , 0 , 0 , 0 ] , //ダウン
[ 0 , 0 ], //落下
[ 0 , 0 ], //技
[ 0, 0, 0, 0, 0 ]//チャージ技
] ;
//アニメーションの条件 0=ウェイト 1=_velocity.yが+方向 2=地面に接地
const $D:Array = [
[ 0 , 0 , 0 , 0 ] , //歩く
[ 0 , 0 , 0 , 0 , 0 , 0 ] , //走る
[ 0 , 1 , 0 , 2 , 0 ] , //飛ぶ
[ 0 , 0 ] , //パンチ
[ 0 , 0 , 0 ] , //強いパンチ
[ 2 , 0 ] , //ジャンプパンチ
[ 2 , 0 ] , //ジャンプキック
[ 0 , 0 ] , //キック
[ 0 ] , //弱ダメージ
[ 0 ] , //中ダメージ
[ 0 ] , //強ダメージ
[ 0 , 0 , 0 , 0 , 2 ] , //ダウン
[ 2 , 0 ], //落下
[ 0 , 0 ], //技
[ 0, 0, 0, 0, 0 ]//チャージ技
] ;
//アニメーション切り替わりの際の特殊動作ID 1=ジャンプ 2=[歩く]状態に戻る
const $E:Array = [
[ 0 , 0 , 0 , 0 ] , //歩く
[ 0 , 0 , 0 , 0 , 0 , 0 ] , //走る
[ 1 , 0 , 0 , 0 , 2 ] , //飛ぶ
[ 0 , 2 ] , //パンチ
[ 0 , 0 , 2 ] , //強いパンチ
[ 0 , 2 ] , //ジャンプパンチ
[ 0 , 2 ] , //ジャンプキック
[ 0 , 2 ] , //キック
[ 2 ] , //弱ダメージ
[ 2 ] , //中ダメージ
[ 2 ] , //強ダメージ
[ 0 , 0 , 0 , 0 , 2 ] , //ダウン
[ 0 , 2 ], //落下
[ 0 , 2 ], //技
[ 0, 0, 0, 0, 2 ]//チャージ技
] ;
//攻撃判定
const $F:Array = [
[ 0 , 0 , 0 , 0 ] , //歩く
[ 0 , 0 , 0 , 0 , 0 , 0 ] , //走る
[ 0 , 0 , 0 , 0 , 0 ] , //飛ぶ
[ 0 , 1 ] , //パンチ
[ 0 , 1 , 0 ] , //強いパンチ
[ 1 , 0 ] , //ジャンプパンチ
[ 1 , 0 ] , //ジャンプキック
[ 0 , 1 ] , //キック
[ 0 ] , //弱ダメージ
[ 0 ] , //中ダメージ
[ 0 ] , //強ダメージ
[ 0 , 0 , 0 , 0 , 0 ] , //ダウン
[ 0 , 0 ], //落下
[ 0 , 2 ], //技
[ 0, 0, 0, 0, 2 ]//チャージ技
] ;