-
Notifications
You must be signed in to change notification settings - Fork 0
/
Enemy2.as
46 lines (39 loc) · 1000 Bytes
/
Enemy2.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
45
46
package
{
import flash.display.MovieClip;
import flash.events.Event;
public class Enemy2 extends MovieClip
{
private var dx = -7;
private var dy = 0;
public function Enemy2(param1:Number, param2:Number)
{
super();
this.addEventListener(Event.ENTER_FRAME,this.moveMe);
this.x = 1200;
this.y = Math.random() * 600;
}
function moveMe(param1:Event) : *
{
x = x + this.dx;
y = y + this.dy;
if(x < -100)
{
x = x + 1200;
}
if(y < 0)
{
y = y + stage.stageHeight;
}
if(y > stage.stageHeight)
{
y = y - stage.stageHeight;
}
}
public function remove2() : *
{
parent.removeChild(this);
this.removeEventListener(Event.ENTER_FRAME,this.moveMe);
}
}
}