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

📄 shape.java

📁 使用netbeans编写的方块游戏TetraGame
💻 JAVA
字号:
/*
 * Shape.java
 *
 * Created on 2007年3月12日, 下午9:00
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package tetrasquare;

/**
 *
 * @author Caviar
 */
import java.io.Serializable;

    //Shape为图形类,1是7型,2是反7,3是正Z,4是反Z,5是田,6是|,7是T型
public class Shape implements Serializable{
    int x1,x2,x3,x4;
    int y1,y2,y3,y4;
    public Shape(int x,int y,int s,int d){
        if(s==1&&d%4==0){
            x1=x;y1=y;x2=x-1;y2=y;x3=x;y3=y+1;x4=x;y4=y+2;
        }
        if(s==1&&d%4==1){
            x1=x;y1=y;x2=x;y2=y-1;x3=x-1;y3=y;x4=x-2;y4=y;
        }
        if(s==1&&d%4==2){
            x1=x;y1=y;x2=x+1;y2=y;x3=x;y3=y-1;x4=x;y4=y-2;
        }
        if(s==1&&d%4==3){
            x1=x;y1=y;x2=x+1;y2=y;x3=x+2;y3=y;x4=x;y4=y+1;
        }
        if(s==2&&d%4==0){
            x1=x;y1=y;x2=x+1;y2=y;x3=x;y3=y+1;x4=x;y4=y+2;
        }
        if(s==2&&d%4==1){
            x1=x;y1=y;x2=x;y2=y+1;x3=x-1;y3=y;x4=x-2;y4=y;
        }
        if(s==2&&d%4==2){
            x1=x;y1=y;x2=x-1;y2=y;x3=x;y3=y-1;x4=x;y4=y-2;
        }
        if(s==2&&d%4==3){
            x1=x;y1=y;x2=x+1;y2=y;x3=x+2;y3=y;x4=x;y4=y-1;
        }
        if(s==3&&(d%4==0||d%4==2)){
            x1=x;y1=y;x2=x-1;y2=y;x3=x;y3=y+1;x4=x+1;y4=y+1;
        }
        if(s==3&&(d%4==1||d%4==3)){
            x1=x;y1=y;x2=x;y2=y+1;x3=x+1;y3=y;x4=x+1;y4=y-1;
        }

        if(s==4&&(d%4==0||d%4==2)){
            x1=x;y1=y;x2=x+1;y2=y;x3=x;y3=y+1;x4=x-1;y4=y+1;
        }
        if(s==4&&(d%4==1||d%4==3)){
            x1=x;y1=y;x2=x;y2=y+1;x3=x-1;y3=y;x4=x-1;y4=y-1;
        }
        if(s==5){
            x1=x;y1=y;x2=x;y2=y+1;x3=x+1;y3=y;x4=x+1;y4=y+1;
        }
        if(s==6&&(d%4==0||d%4==2)){
            x1=x;y1=y;x2=x1;x3=x2;x4=x3;y2=y+1;y3=y+2;y4=y+3;
        }
        if(s==6&&(d%4==1||d%4==3)){
            x1=x;y1=y;x2=x+1;y2=y;x3=x+2;y3=y;x4=x+3;y4=y;
        }
        if(s==7&&d%4==0){
            x1=x;y1=y;x2=x-1;y2=y;x3=x+1;y3=y;x4=x;y4=y+1;
        }
        if(s==7&&d%4==1){
            x1=x;y1=y;x2=x;y2=y-1;x3=x;y3=y+1;x4=x-1;y4=y;
        }
        if(s==7&&d%4==2){
            x1=x;y1=y;x2=x-1;y2=y;x3=x+1;y3=y;x4=x;y4=y-1;
        }
        if(s==7&&d%4==3){
            x1=x;y1=y;x2=x;y2=y+1;x3=x;y3=y-1;x4=x+1;y4=y;
        }
    }
    
}

⌨️ 快捷键说明

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