Packagenet.wonderfl.game.infinity_tank.development
Classpublic class BulletRendererBase
InheritanceBulletRendererBase Inheritance flash.display.Sprite

弾の描画を行うクラス.



Protected Properties
 PropertyDefined by
  _scene : BattleScene
ゲームの現在の情報を取得することが出来ます.
BulletRendererBase
  showStats : Boolean
[write-only] デバッグ用.
BulletRendererBase
Public Methods
 MethodDefined by
  
BulletRendererBase
  
draw($bitmapData:BitmapData):void
この関数は仮想メソッドです.
BulletRendererBase
Protected Methods
 MethodDefined by
  
init():void
このクラスのインスタンスがステージ上の配置されたときに一度だけ実行されるメソッドです.
BulletRendererBase
  
onEnterFrame(e:Event):void
このメソッドはステージ上に配置されたとき、ENTER_FRAMEイベントの イベント・ハンドラとして登録されます.
BulletRendererBase
Property detail
_sceneproperty
protected var _scene:BattleScene

ゲームの現在の情報を取得することが出来ます.

showStatsproperty 
showStats:Boolean  [write-only]

デバッグ用.

Implementation
    protected function set showStats(value:Boolean):void
Constructor detail
BulletRendererBase()constructor
public function BulletRendererBase()
Method detail
draw()method
public function draw($bitmapData:BitmapData):void

この関数は仮想メソッドです. 弾のデザインをするには、このメソッドをオーバーライドします。

Parameters
$bitmapData:BitmapData — $bitmapData ゲームのステージと同じサイズのビットマップが渡されます.

See also


Example

画面上にある弾の座標を取得するには、_scene.myBulletListの中を for文を使って次のような方法でループさせます.全て中心座標となっていますので、 大きさの半分を引くことで弾の左上の座標を取得します.

 override public function draw($bitmapData:BitmapData):void {
        $bitmapData.lock();
        var bullet = new BitmapData(4, 6);
        bullet.fillRect(new Rectangle(0, 0, 6, 6), 0x7fff0000);
        $bitmapData.colorTransform($bitmapData.rect, new ColorTransform(1, 1, 1, 0.9));
        var point:Point;
        for (var i:BoundBox = _scene.myBulletList; i; i = i.next) {
            point.x = i.position.x - i.extents.x / 2;
            point.y = i.position.y - i.extents.y / 2;
               
            $bitmapData.copyPixels(_bullet, _bullet.rect, point);
        }
        $bitmapData.unlock();
 }
 

init()method 
protected function init():void

このクラスのインスタンスがステージ上の配置されたときに一度だけ実行されるメソッドです. wonderflの画面内でのプレビュー・モードのときだけ実行されます.実際のゲーム・モードでは 実行されません.

onEnterFrame()method 
protected function onEnterFrame(e:Event):void

このメソッドはステージ上に配置されたとき、ENTER_FRAMEイベントの イベント・ハンドラとして登録されます.

Parameters
e:Event