Hello, I am a beginner programmer and was following a flappy bird tutorial to get familiar with the language. I am trying to get flappy bird to rotate up and down according to his position. However, I keep getting an error ')' expected that I am having difficulty fixing. Here is my code:
It keeps telling me that it is expecting a end parenthesis after if (dy is between -10 and 10), can anyone help me out?
public class FlappyBird extends Actor
{
double dy = 0;
double g = 1.3;
double BOOST_SPEED = -15;
public void act()
{
setLocation( getX(), (int)(getY() + dy) );
//If user pressed UP arrow, launch flappy bird upward
if (Greenfoot.isKeyDown("up") == true) {
dy = BOOST_SPEED;
}
if (dy is between -10 and 10) {
//set angle to 30
setRotation(30);
}
//If flappybird drops out of the world, then game over
if (getY() > getWorld().getHeight()) {
GameOver gameOver = new GameOver();
getWorld().addObject(gameOver, getWorld().getWidth()/2, getWorld().getHeight()/2);
Greenfoot.stop();
}
dy = dy + g;
}
}
