package maze.eng;
import java.awt.event.KeyEvent;
import maze.Secceed.theSecceed;
public class walkControl
{
public void walkCont(int key, manage theIn)
{
if(key == KeyEvent.VK_LEFT || key == KeyEvent.VK_A)
{
if(theIn.judgeGo(theIn.getX() - 1, theIn.getY()) == 0)
{
theIn.setManage(theIn.getX() - 1, theIn.getY(), '3');
theIn.setManage(theIn.getX(), theIn.getY(), '2');
theIn.setX(theIn.getX() - 1);
}
else if(theIn.judgeGo(theIn.getX() - 1, theIn.getY()) == 1)
{
theSecceed secceed = new theSecceed();
}
}
if(key == KeyEvent.VK_RIGHT || key == KeyEvent.VK_D)
{
if(theIn.judgeGo(theIn.getX() + 1, theIn.getY()) == 0)
{
theIn.setManage(theIn.getX() + 1, theIn.getY(), '3');
theIn.setManage(theIn.getX(), theIn.getY(), '2');
theIn.setX(theIn.getX() + 1);
}
else if(theIn.judgeGo(theIn.getX() + 1, theIn.getY()) == 1)
{
theSecceed secceed = new theSecceed();
}
}
if(key == KeyEvent.VK_UP || key == KeyEvent.VK_W)
{
if(theIn.judgeGo(theIn.getX(), theIn.getY() - 1) == 0)
{
theIn.setManage(theIn.getX(), theIn.getY() - 1, '3');
theIn.setManage(theIn.getX(), theIn.getY(), '2');
theIn.setY(theIn.getY() - 1);
}
else if(theIn.judgeGo(theIn.getX(), theIn.getY() - 1) == 1)
{
theSecceed secceed = new theSecceed();
}
}
if(key == KeyEvent.VK_DOWN || key == KeyEvent.VK_S)
{
if(theIn.judgeGo(theIn.getX(), theIn.getY() + 1) == 0)
{
theIn.setManage(theIn.getX(), theIn.getY() + 1, '3');
theIn.setManage(theIn.getX(), theIn.getY(), '2');
theIn.setY(theIn.getY() + 1);
}
else if(theIn.judgeGo(theIn.getX(), theIn.getY() + 1) == 1)
{
theSecceed secceed = new theSecceed();
}
}
}
}