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

2017/5/12

its saying that im missing a return statement

KSIassassinTB KSIassassinTB

2017/5/12

#
 public boolean isAtEdge()
    {
        if(isTouching(Edge.class))
        {
            needGravity=false;
            getMovement().setLength(1);
            getMovement().revertVertical();
            while(isTouching(Edge.class))
            {
                move();
            }
            move();
            getMovement().setLength(0);
        }
        
    }
KSIassassinTB KSIassassinTB

2017/5/12

#
im using this bc im working with gravity in my code
Yehuda Yehuda

2017/5/12

#
With the way you coded the method you should change line 1 to:
public void isAtEdge()
You created a boolean method which should return a boolean. Like this:
public boolean isTouchingEdge() {
    return isTouching(Edge.class);
}
Since this method is only one line long/short and it's not returning anything that has private access it's unnecessary.
You need to login to post a reply.