-
Notifications
You must be signed in to change notification settings - Fork 1
/
MiniBossMissile.as
44 lines (43 loc) · 1.05 KB
/
MiniBossMissile.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package{
import flash.display.MovieClip;
import flash.events.Event;
public class MiniBossMissile extends MovieClip{
var speed:Number;
var yDirection:Number;
function MiniBossMissile(){
speed = -20;
var s = new MissileSound();
s.play();
graphics.lineStyle(6,0x000000);
graphics.moveTo(-4,0);
graphics.lineTo(4,0);
graphics.lineStyle(2,0xff0000);
graphics.moveTo(-3,0);
graphics.lineTo(3,0);
addEventListener("enterFrame", enterFrame);
}
function enterFrame(e:Event){
this.x += speed;
if(yDirection){
this.y += yDirection*4;
}
if(this.x < 0){
removeEventListener("enterFrame", enterFrame);
stage.removeChild(this);
return;
}
if(this.hitTestObject(Game.ship)){
removeEventListener("enterFrame", enterFrame);
stage.removeChild(this);
if(Game.ship.shield.visible == false){
Game.ship.takeDamage(10);
}
}
for(var i in Wingman.list) {
if(this.hitTestObject(Wingman.list[i])){
Wingman.list[i].kill();
}
}
}
}
}