java 俄罗斯方块

来源:百度知道 编辑:UC知道 时间:2024/05/15 12:12:28
请高手指教 当方块到达底部时 怎么样固定方块 并且让新的方块产生并且下落 这个过程我暂时没法实现 请高手帮忙指点迷津 希望在详细讲解其过程并且通俗易懂 谢谢
我是一个初学者 所以希望高手们 不要整些复杂的代码上来 第一我可能看不懂 第二发代码时希望详细讲述其过程 注释和讲解相当重要啊

import java.awt.*;
import java.awt.event.*;
//俄罗斯方块类
public class Mytest extends Frame{
public static boolean isPlay=false;
public static int level=1,score=0;
public static TextField scoreField,levelField;

public static MyTimer timer;
GameCanvas gameScr;

public static void main(String[] argus){
Mytest ers = new Mytest("俄罗斯方块游戏");
WindowListener win_listener = new WinListener();
ers.addWindowListener(win_listener);
}

// 俄罗斯方块类的构造方法
Mytest(String title){
super(title);

setSize(600,480);
setLayout(new GridLayout(1,2));

gameScr = new GameCanvas();
gameScr.addKeyListener(gameScr);

timer = new MyTimer(gameScr);
timer.setDaemon(true);
timer.start();
timer.suspend();

add(gameScr);

Panel rightScr = new Panel();
rightScr.setLayout(new GridLayout(2,1,0,30));
ri