Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import flash.display.Sprite;
- import flash.events.Event;
- import flash.events.KeyboardEvent;
- /**
- * ...
- * @author KOchan
- */
- import flash.display.GradientType;
- public class Player extends Sprite
- {
- public function Player(x:int, y:int)
- {
- this.x = x;
- this.y = y;
- drawBody();
- stage.addEventListener(KeyboardEvent.KEY_DOWN, keyListener);
- }
- private function drawBody():void {
- var body:Sprite = new Sprite();
- body.graphics.beginGradientFill(GradientType.LINEAR, [0x000000, 0x0000FF], [1, 1], [0x00, 0xFF]);
- body.graphics.drawRect(0, 0, 40, 60);
- addChild(body);
- }
- private function keyListener(e:KeyboardEvent):void {
- trace(e.keyCode);
- }
- }
- }
Add Comment
Please, Sign In to add comment