root/as2/Endflow/sample/KeyIf/Ship.as

リビジョン 18, 0.6 kB (コミッタ: kuy, コミット時期: 2 年 前)

KeyIf?クラスを追加。

Line 
1 class Ship {
2         private var mc:MovieClip;
3        
4         public function Ship(parent:MovieClip) {
5                 this.mc = parent.attachMovie('ship', 'ship_mc', parent.getNextHighestDepth());
6                 this.reset();
7         }
8        
9         public function up():Void {
10                 this.mc._y -= 5;
11         }
12        
13         public function down() {
14                 this.mc._y += 5;
15         }
16        
17         public function left():Void {
18                 this.mc._x -= 5;
19         }
20        
21         public function right():Void {
22                 this.mc._x += 5;
23         }
24        
25         public function shot():Void {
26                 new Bullet(this.mc._parent, {_x: this.mc._x, _y: this.mc._y - 20});
27         }
28        
29         public function reset():Void {
30                 this.mc._x = Stage.width / 2;
31                 this.mc._y = Stage.height / 2;
32         }
33 }
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。