New Q of the day

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JavanoobX
    New Member
    • Mar 2009
    • 5

    New Q of the day

    How do i make this guy grow? i tried typing rightLeg.GROW() ; but it said grow was not a command or something

    Code:
    import objectdraw.*;
    import java.awt.*;
    
    //A project that makes a man grow when he is clicked by the evil mouse pointer.
    //The man is to get larger with every click to show that he is enraged.
    
    
    public class GrowManMathias extends FrameWindowController { 
    // amount each body part grows by (should be even) 
    private static final int GROW = 2;
    
    // initial size of head 
    private static final int HEAD_SIZE = 6; 
    private static final int LIMB_SIZE = 5; 
    // initial displacement of ends of 
    // limbs from body, both horizontally 
    // and vertically 
    private static final int HEAD_START = 50; 
    // x and y coordinate of initial 
    // starting point 
    // coordinates of body parts 
    private static final int BODY_X = HEAD_START + HEAD_SIZE / 2; 
    private static final int NECK_Y = HEAD_START + HEAD_SIZE; 
    private static final int ARMPIT_Y = HEAD_START + 2 * HEAD_SIZE; 
    private static final int BODY_END = HEAD_START + 3 * HEAD_SIZE; 
    private static final int FEET_Y = BODY_END + LIMB_SIZE; 
    private static final int ARMS_Y = ARMPIT_Y - LIMB_SIZE; 
    private static final int LEFT_X = BODY_X - LIMB_SIZE; 
    private static final int RIGHT_X = BODY_X + LIMB_SIZE; 
    
    // instance variables 
    private FramedOval head; 
    private Line body, leftArm, rightArm, leftLeg, rightLeg;
    
    
    //Flavor Text
    private Text anger;
    
        public void begin(){
            head = new FramedOval(HEAD_START,HEAD_START,HEAD_SIZE,HEAD_SIZE,canvas);
            body = new Line(BODY_X,NECK_Y,BODY_X,BODY_END,canvas);
            leftArm = new Line(BODY_X,ARMPIT_Y,LEFT_X,NECK_Y,canvas);
            rightArm = new Line(BODY_X,ARMPIT_Y,RIGHT_X,NECK_Y,canvas);
           // leftLeg= new Line(BODY_END,BODY_END,LEFT_X,FEET_Y,canvas);
           // rightArm = new Line(BODY_X,ARMS_Y,RIGHT_X,ARMPIT_Y,canvas);
           //leftLeg = new Line(LEFT_X,BODY_END,BODY_END,FEET_Y,canvas);
           leftLeg = new Line(BODY_X,BODY_END,LEFT_X,FEET_Y,canvas);
           rightLeg = new Line(BODY_X,BODY_END,RIGHT_X,FEET_Y,canvas);
           new Text("Click on the little man and see a show",80,50,canvas);
        }
        
       public void onMouseClick(Location point){
           anger = new Text("Your clicking only enrages and infurriates me, please stop.",point,canvas);
           anger.setColor(Color.RED);//Red means hes angry, it stays because when he is growing he stays enraged, that and I didnt know how to clear the text without clearing the body.
           
        }
        
        
    }
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    That is because there is no method called GROW that takes no arguments in your Line class.
    How to make the man grow depends on the rest of your code which we don't have. I am not asking you to post the rest of your code.

    P.S If you wrote the code then surely you must know where to change to make the man grow. Did you write the code yourself?

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by JavanoobX
      How do i make this guy grow?
      I find that a rather personal question to ask in a public forum ...

      kind regards,

      Jos ;-)

      ps. your question doesn't make any sense and neither does your code.

      Comment

      Working...