im trying to change the speed a character moves at by using an else if statment. its not working, any ideas?
private void moveLeft()
{
setLocation(getX()-1, getY());
}
private void moveRight()
{
setLocation(getX()+1, getY());
}
private void moveUp()
{
setLocation(getX(), getY()-2);
}
private void moveDown()
{
setLocation(getX(), getY()+2);
}
private void SmoveUp()
{
setLocation(getX(), getY()-1);
}
private void SmoveDown()
{
setLocation(getX(), getY()+1);
}
private void checkKeyPress()
{
if (Greenfoot.isKeyDown("left"))
{
moveLeft();
}
if (Greenfoot.isKeyDown("right"))
{
moveRight();
}
if (Greenfoot.isKeyDown("up"))
{
if(getX()!=(200)+200)
{
SmoveUp();
}
else
moveUp();
}
if (Greenfoot.isKeyDown("down"))
{
if(getX()!=(200)+200)
{
SmoveDown();
}
else
moveDown();
}
}
