Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
311 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package | ||
{ | ||
import net.flashpunk.graphics.Image; | ||
/** | ||
* ... | ||
* @author William David Hunt | ||
*/ | ||
public class Aimer extends Enemy | ||
{ | ||
[Embed(source = 'assets/enemy_32_3.png')] | ||
private const SPRITE:Class; | ||
|
||
public function Aimer(_x:Number = 0, _y:Number = 0, _vx:Number = 0, _vy:Number = 0) | ||
{ | ||
super(_x, _y, _vx, _vy); | ||
image = new Image(SPRITE); | ||
image.centerOO(); | ||
graphic = image; | ||
} | ||
|
||
override public function update():void | ||
{ | ||
x += vx; | ||
y += vy; | ||
|
||
var p1:Player = Level(world).p1; | ||
var p2:Player = Level(world).p2; | ||
|
||
if (time % 150 == 0) { | ||
shootAt(p1.x, p1.y); | ||
shootAt(p2.x, p2.y); | ||
} | ||
|
||
time += 1; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package | ||
{ | ||
import net.flashpunk.graphics.Image; | ||
/** | ||
* ... | ||
* @author William David Hunt | ||
*/ | ||
public class BeamSpam extends Enemy | ||
{ | ||
|
||
[Embed(source = '../assets/enemy_32_1.png')] | ||
private const SPRITE:Class; | ||
|
||
private var angle:Number = 0; | ||
private var targetX:Number; | ||
private var targetY:Number; | ||
|
||
public function BeamSpam(_x:Number = 0, _y:Number = 0, _vx:Number = 0, _vy:Number = 0) | ||
{ | ||
super(_x, _y, _vx, _vy); | ||
image = new Image(SPRITE); | ||
image.centerOO(); | ||
graphic = image; | ||
} | ||
|
||
override public function update():void | ||
{ | ||
if (time % 150 == 120) { | ||
if (Toolbox.randBool()) { | ||
targetX = Level(world).p1.x; | ||
targetY = Level(world).p1.y; | ||
} else { | ||
targetX = Level(world).p2.x; | ||
targetY = Level(world).p2.y; | ||
} | ||
} else if (time % 150 > 120) { | ||
shootAt(targetX, targetY); | ||
} else { | ||
x += vx; | ||
y += vy; | ||
} | ||
|
||
if (x < 0 || x > 640 || y < 0 || y > 480) { | ||
world.remove(this); | ||
} | ||
|
||
|
||
time += 1; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package | ||
{ | ||
import net.flashpunk.graphics.Image; | ||
/** | ||
* ... | ||
* @author William David Hunt | ||
*/ | ||
public class CrossShooter extends Enemy | ||
{ | ||
|
||
[Embed(source = '../assets/enemy_32_2.png')] | ||
private const SPRITE:Class; | ||
|
||
private var angle:Number = 0; | ||
|
||
private var dvx:Number; | ||
private var dvy:Number; | ||
|
||
public function CrossShooter(_x:Number = 0, _y:Number = 0, _vx:Number = 0, _vy:Number = 0) | ||
{ | ||
super(_x, _y, _vx, _vy); | ||
image = new Image(SPRITE); | ||
image.centerOO(); | ||
graphic = image; | ||
|
||
dvx = _vx; | ||
dvy = _vy; | ||
} | ||
|
||
override public function update():void | ||
{ | ||
x += vx; | ||
y += vy; | ||
|
||
angle += 1; | ||
angle = angle % 360; | ||
|
||
var pos:Array = Toolbox.movePoint(0, 0, angle, 1); | ||
vx = pos[0] + dvx; | ||
vy = pos[1] + dvy; | ||
|
||
if (time % 60 == 0 && time % 120 != 0 ) { | ||
shootAt(x + 100, y + 100); | ||
shootAt(x - 100, y - 100); | ||
shootAt(x - 100, y + 100); | ||
shootAt(x + 100, y - 100); | ||
} else if ( time % 120 == 0) { | ||
shootAt(x + 100, y); | ||
shootAt(x - 100, y); | ||
shootAt(x, y + 100); | ||
shootAt(x, y - 100); | ||
} | ||
|
||
if (x < 0 || x > 640 || y < 0 || y > 480) { | ||
world.remove(this); | ||
} | ||
|
||
|
||
time += 1; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package | ||
{ | ||
import net.flashpunk.graphics.Image; | ||
/** | ||
* ... | ||
* @author William David Hunt | ||
*/ | ||
public class Rotating extends Enemy | ||
{ | ||
|
||
[Embed(source = '../assets/enemy_32_3.png')] | ||
private const SPRITE:Class; | ||
|
||
private var angle:Number = 0; | ||
|
||
public function Rotating(_x:Number = 0, _y:Number = 0, _vx:Number = 0, _vy:Number = 0) | ||
{ | ||
super(_x, _y, _vx, _vy); | ||
image = new Image(SPRITE); | ||
image.centerOO(); | ||
graphic = image; | ||
} | ||
|
||
override public function update():void | ||
{ | ||
x += vx; | ||
y += vy; | ||
|
||
angle += 1; | ||
angle = angle % 360; | ||
|
||
var pos:Array = Toolbox.movePoint(0, 0, angle, 0.5); | ||
vx = pos[0]; | ||
vy = pos[1]; | ||
|
||
if (time % 45 == 0 ) { | ||
shootAt(x - pos[0], y - pos[1]); | ||
} | ||
|
||
time += 1; | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.