import org.newdawn.slick.Input; //导入方法依赖的package包/类
/**
* This method moves the character on the map based on the input
* @param input send by the keybord from user
*/
public void manualMovement(Input input){
setControlKeys();
setCorners();
if ((input.isKeyDown(comands[0]) || memButton == 1) && checkBlockUp()){
memButton = 1;
if (otherKeyPress(input, comands[0])){
memButton = 0;
}else{
y -= speed;
direction = Directions.UP;
}
}
if ((input.isKeyDown(comands[1]) || memButton == 2) && checkBlockDown()){
memButton = 2;
if (otherKeyPress(input, comands[1])){
memButton = 0;
}else{
y += speed;
direction = Directions.DOWN;
}
}
if ((input.isKeyDown(comands[2]) || memButton == 3) && checkBlockLeft()){
memButton = 3;
if (otherKeyPress(input, comands[2])){
memButton = 0;
}else{
x -= speed;
direction = Directions.LEFT;
}
if (checkTunnelLeft())
x = tileWidth * (mapWidth - 1);
}
if (((input.isKeyDown(comands[3]) || memButton == 4) && checkBlockRight())){
memButton = 4;
if (otherKeyPress(input, comands[3])){
memButton = 0;
}else{
x += speed;
direction = Directions.RIGHT;
}
if (checkTunnelRight())
x = 0;
}
}