⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snakesystem.java

📁 一个贪吃蛇游戏
💻 JAVA
字号:
/**
 * @(#)SnakeSystem.java
 * @The system of all the temporary information.
 *
 * @Link Scholes
 * @version 1.00 2008/7/21
 */

package System;

import Data.*;

public class SnakeSystem
{
	private int direction;
	private int life;
	private int position;
	private Snake snake;
	
	//construct a system with a snake of three lives
	public SnakeSystem()
	{
		direction = 1;
		life = 3;
		position = 0;
		snake = new Snake(0);
	}
	
	//get the direction of the current game
	public int getDirection()
	{
		return direction;
	}
	
	//get the life of the current game
	public int getLife()
	{
		return life;
	}
	
	//get the position of the current game
	public int getPosition()
	{
		return position;
	}
	
	//get the length of the snake
	public int getLength()
	{
		return snake.getLength();
	}
	
	//add a new head to the snake
	public void addHead(int n)
	{
		snake.addHead(n);
	}
	
	//cut the tail of the snake
	public int cutTail()
	{
		return snake.cutTail();
	}
	
	//increase the length of the snake
	public void increase()
	{
		snake.increase();
	}
	
	//decrease the length of the snake
	public void decrease()
	{
		snake.decrease();
	}
	
	//clear all the points of the snake
	public int[] clear()
	{
		return snake.clear();
	}
	
	//increase the life of the snake
	public void neos()
	{
		life ++;
	}
	
	//decrease the length of the snake
	public void reborn()
	{
		life --;
		snake = new Snake(position);
	}
	
	//go to next stage
	public void newStage(int a,int b)
	{
		direction = a;
		position = b;
		snake = new Snake(position);
	}
}	//end class SnakeSystem

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -