Guest User

Untitled

a guest
Jun 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package  
  2. {
  3.     import flash.display.Sprite;
  4.     import flash.events.Event;
  5.     import flash.events.KeyboardEvent;
  6.    
  7.     /**
  8.      * ...
  9.      * @author KOchan
  10.      */
  11.    
  12.     import flash.display.GradientType;
  13.      
  14.     public class Player extends Sprite
  15.     {
  16.        
  17.         public function Player(x:int, y:int)
  18.         {
  19.             this.x = x;
  20.             this.y = y;
  21.            
  22.             drawBody();
  23.             stage.addEventListener(KeyboardEvent.KEY_DOWN, keyListener);
  24.         }
  25.        
  26.         private function drawBody():void {
  27.            
  28.             var body:Sprite = new Sprite();
  29.            
  30.             body.graphics.beginGradientFill(GradientType.LINEAR, [0x000000, 0x0000FF], [1, 1], [0x00, 0xFF]);
  31.             body.graphics.drawRect(0, 0, 40, 60);
  32.            
  33.             addChild(body);
  34.        
  35.         }
  36.        
  37.         private function keyListener(e:KeyboardEvent):void {
  38.            
  39.             trace(e.keyCode);
  40.            
  41.         }
  42.        
  43.     }
  44.  
  45. }
Add Comment
Please, Sign In to add comment