Advertisement
Guest User

Untitled

a guest
Jan 21st, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Geomy
  2. {
  3.    
  4.     /**
  5.      * ...
  6.      * @author Erlend
  7.      */
  8.     /** moving object */
  9.     public class  Body
  10.     {
  11.         public var x:Number = 0;
  12.         public var y:Number = 0;
  13.         public var xSpeed:Number = 0;
  14.         public var ySpeed:Number = 0;
  15.        
  16.         protected var _density:Number = 1;
  17.         /** Calculates new mass. */
  18.         public function set density(value:Number):void {
  19.             _density = value;
  20.             calculateMass();
  21.         }
  22.         public function get density():Number {
  23.             return _density;
  24.         }
  25.        
  26.         protected var _mass:Number = 0;
  27.         /** Read only! */
  28.         public function get mass():Number {
  29.             return _mass;
  30.         }
  31.        
  32.         public function Body():void
  33.         {
  34.             // ABSTRACT
  35.         }
  36.         public function setPosition(x:Number, y:Number):void
  37.         {
  38.             this.x = x;
  39.             this.y = y;
  40.         }
  41.        
  42.         protected function calculateMass():void
  43.         {
  44.            
  45.         }
  46.         /**
  47.          * Returns true if it overlaps shape argument
  48.          */
  49.         public function solveCollision(shape:Shape):Boolean
  50.         {
  51.             return false;
  52.         }
  53.        
  54.        
  55.         public function setSpeed(xSpeed:Number, ySpeed:Number):void
  56.         {
  57.             this.xSpeed = xSpeed;
  58.             this.ySpeed = ySpeed;
  59.         }
  60.     }
  61.    
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement