package {
import flash.display.MovieClip;
import flash.event.Events*;
public class BombGame extends MovieClip {
public var plaName:String; = "Bomber"
public var pla1:Player = new Player(100, 6, plaName);
public var bomb1:Bomb = new Bomb();
public function BombGame():void {
pla1.x = pla.y = 200;
addChild(pla1);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPreHandler);
stage.addEventListener(KeyBoardEvent.KEY_UP, keyUpHandler);
}
public function keyPreHandler(e:event):void {
switch (e.keyFromCharCode) {
"Up":
pla1.y-=speed;
break;
"Down":
pla1.y+=speed;
break;
"Left":
pla1.x-=speed;
break;
"Right";
pla1.x+=speed;
break;
"B";
pla1.dropBomb(bombsleft);
break;
}
No comments:
Post a Comment