Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package {
- import net.flashpunk.Entity;
- import net.flashpunk.Graphic;
- import net.flashpunk.Mask;
- import net.flashpunk.graphics.Image;
- import net.flashpunk.graphics.Spritemap;
- import net.flashpunk.masks.Pixelmask;
- public class Player extends Entity {
- [Embed(source = "../res/player.png")] private const IMAGE:Class;
- public var k:Number = 0;
- public var anim:Spritemap;
- public function Player(x:Number=0, y:Number=0) {
- super(x, y);
- //Graphic init
- graphic = new Image(IMAGE);
- (graphic as Image).originX = 8;
- (graphic as Image).originY = 8;
- //Collision init
- mask = new Pixelmask(IMAGE);
- type = "player";
- //Animation init
- anim = new Spritemap(LEGS, 16, 16);
- }
- override public function update():void{
- super.update();
- (graphic as Image).angle = Math.sin(k += 0.1) * 15;
- }
- }
- }
Add Comment
Please, Sign In to add comment