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

📄 position.java

📁 Position.java :辅助类 SerpentGameCanvas.java :游戏主控类 Maze.java :迷宫 SerpentGame.java :应用主控类 Serpent.java
💻 JAVA
字号:
public class Position
{
	public int x;
	public int y;
	
	public Position() {}
	
	public Position(Position pos)
	{
		x=pos.x;
		y=pos.y;
	}
	
	public Position(int xParam, int yParam)
	{
		x=xParam;
		y=yParam;
	}
	
	public void setValue(int xParam, int yParam)
	{
		x=xParam;
		y=yParam;
	}

	public void setValue(Position pos)
	{
		x=pos.x;
		y=pos.y;
	}
	
	public void setValue(Position pos, int xParam, int yParam)
	{
		x=pos.x + xParam;
		y=pos.y + yParam;
	}
	
	public void add(Position pos)
	{
		x+=pos.x;
		y+=pos.y;
	}

	public boolean equals(Position pos)
	{
		return ( x==pos.x && y==pos.y );
	}
	
	public boolean outOfRange(int left, int top, int right, int bottom)
	{
		return ( x<left || x>right || y<top || y>bottom );
	}
	
	public String toString()
	{
		String s=new String();
		s="[" + String.valueOf( x ) + ", " + String.valueOf( y ) + "]";
		return s;
	}
	
}

⌨️ 快捷键说明

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