Курсовая работа: Гра Змійка опис програми
public void setMoveUp(){
xNextSpeed = 0; yNextSpeed = -1;
};
public void setMoveDown(){
xNextSpeed = 0; yNextSpeed = 1;
};
public void setMoveLeft(){
xNextSpeed = -1; yNextSpeed = 0;
};
public void setMoveRight(){
xNextSpeed = 1; yNextSpeed = 0;
};
public boolean isMaxLong(){return (colElements == maxLen);}
public boolean isKilled(){return (lives<0);}
public void decrementLive(){lives -=1;}
public int getLives(){ return lives;}
}
3.1.6. Файл SnakeElement.java
class SnakeElement {
int xSpeed=1;
int ySpeed=1;
int xPos=1;
int yPos=1;
public SnakeElement(int xPos, int yPos){
this.xPos = xPos;
this.yPos = yPos;
}
public void move(){
xPos += xSpeed;
yPos += ySpeed;