Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2011
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. /**
  2.  * This class represents a physical body that can have colour.
  3.  */
  4.  
  5. package robot.objects;
  6.  
  7. import net.phys2d.raw.Body;
  8. import net.phys2d.raw.shapes.DynamicShape;
  9. import net.phys2d.raw.shapes.Shape;
  10.  
  11. public class ColouredBody extends Body {
  12.  
  13.  
  14.     /**
  15.      * Holds the colour of the coloured body.
  16.      */
  17.     private Colour colour;
  18.  
  19.     /**
  20.      * Creates a new coloured body with the specified colour.
  21.      *
  22.      * @param name The name to assign to the body
  23.      * @param shape The shape describing this body
  24.      * @param m The mass of the body
  25.      */
  26.    
  27.     public ColouredBody(String name,DynamicShape shape, float m, Colour colour){
  28.         super(name,(Shape) shape,m);
  29.         this.setColour(colour);
  30.     }
  31.  
  32.     /**
  33.      * Sets the colour of the body.
  34.      * @param colour
  35.      */
  36.  
  37.     public final void setColour(Colour colour) {
  38.         this.colour = colour;
  39.     }
  40.  
  41.     /**
  42.      * Returns the colour of the body.
  43.      * @return The colour of the body.
  44.      */
  45.  
  46.     public Colour getColour(){
  47.         return this.colour;
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement