Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualxDarkShadowKnightx

Posted 20 February 2013 - 09:44 PM

Here's a simple example of what you could do, shouldn't be to hard to understand but if you can't understand it then just ask.

bool direction = false;

public void ballmove()
{
    if(direction = false){
        if(x >= 0)
            x++;
        else
            direction = true;
    }else{
        if(x <= 420)
            x--;
        else
            direction = false;
    }
}
 

EDIT: This kinda illustrates what Navall and thyagobr are talking about with the directions and stuff


#1xDarkShadowKnightx

Posted 20 February 2013 - 09:42 PM

Here's a simple example of what you could do, shouldn't be to hard to understand but if you can't understand it then just ask.

bool direction = false;

public void ballmove()
{
    if(direction = false){
        if(x >= 0)
            x++;
        else
            direction = true;
    }else{
        if(x <= 420)
            x--;
        else
            direction = false;
    }
}
 

PARTNERS