This site requires JavaScript, please enable it in your browser!
Greenfoot back
MayorWolf
MayorWolf wrote ...

2018/9/29

JAVADOC - Commented methods not showing up in the documentation.

MayorWolf MayorWolf

2018/9/29

#
I recently started using Greenfoot and ran into a problem with JavaDoc. I finished documenting a class but only act() shows up in the documentation. Is there something I don't see, as I am an concerned the JavaDoc commands are basically the same.
/**
     * Act - a method called repeatedly by the Greenfoot enviroment.
     * This method is called whenever the 'Act' or 'Run' button gets pressed in the environment.
     * It is the main drive of the turtle and lets it behave like it does.
     */
    public void act() 
    {
        speedIndicatorChange(); //{@see speedIndcatorChange} shows the turtles speed on screen.
        //The folowing if statement checks if the turtles direction was changed by a users input.
        if (Greenfoot.isKeyDown("left")){ 
            setRotation(180);
        }   
        else if (Greenfoot.isKeyDown("right")){
            setRotation(0);
        }
        else if (Greenfoot.isKeyDown("up")){
            setRotation(270);
        }
        else if (Greenfoot.isKeyDown("down")){
            setRotation(90);
        }
        //The following if statement checks if the turtles speed was changed by a users input.
        if (Greenfoot.isKeyDown("g")){
            upSpeed();
        }
            else if (Greenfoot.isKeyDown("k")){
            downSpeed();
        }
            else{
        }
    
        move(turtleSpeed); //Moves the turtle a certain amount of pixels.
    }  
    /**
     * upSpeed - accelerates the turtle.
     * The method is called if the user presses the "g"-key.
     * It increases the turtleSpeed variable to a maximum of 10, 
     * thus increasing the pixels crossed by the turtle every act.
     */
    private void upSpeed(){
        if (turtleSpeed == 10){ //Caps the speed of the turtle at 10.
        }
        else {
            turtleSpeed = turtleSpeed + 1;
            speedIndicatorChange(); //Changes the on screen speed indicator.
        }
    }
MayorWolf MayorWolf

2018/9/29

#
SOLVED: The methods must be public!
You need to login to post a reply.