📄 floor.java
字号:
repaint();
stepsound.play();
pause(20);
}
cleanUp();
unoccupy1();
}
}
else if(who==2)
{
if(destination == elevator_door)
{
moving = true;
while(xPos2 < 180)
{
xPos2++;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
}
if(destination == leave_elevator_door)
{
moving = true;
while(xPos2 > 1)
{
xPos2--;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
unOccupy2();
}
}
else if(who==3)
{
if(destination == elevator_door)
{
moving = true;
while(xPos3 < 170)
{
xPos3++;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
}
if(destination == leave_elevator_door)
{
moving = true;
while(xPos3 > 1)
{
xPos3--;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
unOccupy3();
}
}
else if(who==4)
{
if(destination == elevator_door)
{
moving = true;
while(xPos4 < 160)
{
xPos4++;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
}
if(destination == leave_elevator_door)
{
moving = true;
while(xPos4 > 1)
{
xPos4--;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
unOccupy4();
}
}
else if(who==5)
{
if(destination == elevator_door)
{
moving = true;
while(xPos5 < 150)
{
xPos5++;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
}
if(destination == leave_elevator_door)
{
moving = true;
while(xPos5 > 1)
{
xPos5--;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
unOccupy5();
}
}
else if(who==6)
{
if(destination == elevator_door)
{
moving = true;
while(xPos6 < 140)
{
xPos6++;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
}
if(destination == leave_elevator_door)
{
moving = true;
while(xPos6 > 1)
{
xPos6--;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
unOccupy6();
}
}
else if(who==7)
{
if(destination == elevator_door)
{
moving = true;
while(xPos7 < 130)
{
xPos7++;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
}
if(destination == leave_elevator_door)
{
moving = true;
while(xPos7 > 1)
{
xPos7--;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
unOccupy7();
}
}
else if(who==8)
{
if(destination == elevator_door)
{
moving = true;
while(xPos8 < 120)
{
xPos8++;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
}
if(destination == leave_elevator_door)
{
moving = true;
while(xPos8 > 1)
{
xPos8--;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
unOccupy8();
}
}
else if(who==9)
{
if(destination == elevator_door)
{
moving = true;
while(xPos9 < 110)
{
xPos9++;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
}
if(destination == leave_elevator_door)
{
moving = true;
while(xPos9 > 1)
{
xPos9--;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
unOccupy9();
}
}
else if(who==0)
{
if(destination == elevator_door)
{
moving = true;
while(xPos0 < 100)
{
xPos0++;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
}
if(destination == leave_elevator_door)
{
moving = true;
while(xPos0 > 1)
{
xPos0--;
repaint();
stepsound.play();
pause(20);
}
cleanUp();
unOccupy0();
}
}
}
public void cleanUp()
{
moving = false;
destination = 0;
}
public void paint(Graphics g)
{
g.drawImage(floor, 1, 1, this);
if(occupied1)
{
g.drawImage(person1, xPos1, 40, this);
}
if(occupied2)
{
g.drawImage(person2, xPos2, 40, this);
}
if(occupied3)
{
g.drawImage(person3, xPos3, 40, this);
}
if(occupied4)
{
g.drawImage(person4, xPos4, 40, this);
}
if(occupied5)
{
g.drawImage(person5, xPos5, 40, this);
}
if(occupied6)
{
g.drawImage(person6, xPos6, 40, this);
}
if(occupied7)
{
g.drawImage(person7, xPos7, 40, this);
}
if(occupied8)
{
g.drawImage(person8, xPos8, 40, this);
}
if(occupied9)
{
g.drawImage(person9, xPos9, 40, this);
}
if(occupied0)
{
g.drawImage(person0, xPos0, 40, this);
}
}
public void update(Graphics g)
{
paint(g);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -