Created
September 26, 2010 18:25
-
-
Save zachwlewis/598179 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package | |
{ | |
import flash.geom.Rectangle; | |
import net.flashpunk.Entity; | |
import net.flashpunk.FP; | |
import net.flashpunk.graphics.Image; | |
/** | |
* Describes an enemy. | |
* @author Zachary Weston Lewis | |
*/ | |
public class Enemy extends Entity | |
{ | |
public function Enemy() | |
{ | |
switch(FP.rand(4)) | |
{ | |
case 0: | |
_image = new Image(Assets.SPRITE_ENEMIES, new Rectangle(0, 0, 8, 8); | |
_image.color = 0xff0000; | |
break; | |
case 1: | |
_image = new Image(Assets.SPRITE_ENEMIES, new Rectangle(8, 0, 8, 8); | |
_image.color = 0x0000ff; | |
break; | |
case 2: | |
_image = new Image(Assets.SPRITE_ENEMIES, new Rectangle(16, 0, 8, 8); | |
_image.color = 0xff6666; | |
break; | |
case 3: | |
_image = new Image(Assets.SPRITE_ENEMIES, new Rectangle(24, 0, 8, 8); | |
_image.color = 0xff0066; | |
break; | |
default: | |
break; | |
} | |
} | |
// Member variables | |
protected var _s:Point; | |
protected var _v:Point; | |
protected var _a:Point; | |
protected var _speed:Number; | |
protected var _angle:Number; | |
protected var _image:Image; | |
protected var _renderTarget:BitmapData; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment