daily pastebin goal
37%
SHARE
TWEET

Untitled

a guest Dec 12th, 2018 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package {
  2.     import net.flashpunk.Entity;
  3.     import net.flashpunk.Graphic;
  4.     import net.flashpunk.Mask;
  5.     import net.flashpunk.graphics.Image;
  6.     import net.flashpunk.graphics.Spritemap;
  7.     import net.flashpunk.masks.Pixelmask;
  8.    
  9.     public class Player extends Entity {
  10.         [Embed(source = "../res/player.png")] private const IMAGE:Class;
  11.        
  12.         public var k:Number = 0;
  13.         public var anim:Spritemap;
  14.        
  15.         public function Player(x:Number=0, y:Number=0) {
  16.             super(x, y);
  17.             //Graphic init
  18.             graphic = new Image(IMAGE);
  19.             (graphic as Image).originX = 8;
  20.             (graphic as Image).originY = 8;
  21.             //Collision init
  22.             mask = new Pixelmask(IMAGE);
  23.             type = "player";
  24.             //Animation init
  25.             anim = new Spritemap(LEGS, 16, 16);
  26.         }
  27.        
  28.         override public function update():void{
  29.             super.update();
  30.             (graphic as Image).angle = Math.sin(k += 0.1) * 15;
  31.         }
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top