turnz.java

来自「俄罗斯方块游戏」· Java 代码 · 共 69 行

JAVA
69
字号
import java.awt.*;
public class Turnz extends SquareShape {
	private Color trunzColor=new Color(100,0,100);
	public Turnz() {
		super();
		this.color=trunzColor;
		// TODO Auto-generated constructor stub
	}

	protected void defaultRotate() {
		// TODO Auto-generated method stub
		for(int i=0;i<2;i++)
		{
			postion[i][0]=xpos+(i-1)*20;
			postion[i][1]=ypos;
		}
		for(int i=2;i<4;i++)
		{
			postion[i][0]=xpos+(i-2)*20;
			postion[i][1]=ypos+20;
		}

	}

	protected void firstRotate() {
		// TODO Auto-generated method stub
		for(int i=0;i<2;i++)
		{
			postion[i][0]=xpos+20;
			postion[i][1]=ypos+i*20;
		}
		for(int i=2;i<4;i++)
		{
			postion[i][0]=xpos;
			postion[i][1]=ypos+(i-1)*20;
		}
	}

	protected void secondRotate() {
		// TODO Auto-generated method stub
		for(int i=0;i<2;i++)
		{
			postion[i][0]=xpos+(i-1)*20;
			postion[i][1]=ypos;
		}
		for(int i=2;i<4;i++)
		{
			postion[i][0]=xpos+(i-2)*20;
			postion[i][1]=ypos+20;
		}
	}

	protected void thirdRotate() {
		// TODO Auto-generated method stub
		for(int i=0;i<2;i++)
		{
			postion[i][0]=xpos+20;
			postion[i][1]=ypos+i*20;
		}
		for(int i=2;i<4;i++)
		{
			postion[i][0]=xpos;
			postion[i][1]=ypos+(i-1)*20;
		}

	}

}

⌨️ 快捷键说明

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