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

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

KeyIf?.as 0.2.0 Keyクラスで定義されていないキーコード指定にも対応。
Delay.as 0.1.0 初版。サンプルで必要になったので。

Line 
1 import net.endflow.util.KeyIf;
2 import net.endflow.util.Delay;
3
4 var ship:Ship = new Ship(_root);
5 Key.addListener(this);
6 this.onKeyDown = KeyIf.f({
7         UP: function(){ship.up()},
8         DOWN: function(){ship.down()},
9         LEFT: function(){ship.left()},
10         RIGHT: function(){ship.right()},
11         SPACE: {CONTROL: {_90: function(){ship.shot()}}},
12         PGUP: [function(){ship.up()}, function(){ship.shot()}],
13         PGDN: [function(){ship.down()}, function(){ship.shot()}],
14         HOME: {_82: function(){ship.reset()}},
15         _88: function(){
16                 ship.shot();
17                 Delay.f(function(){
18                         ship.shot();
19                         Delay.f(function(){
20                                 ship.shot();
21                         }, 200);
22                 }, 200);
23         }
24 });
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。