Stein unten gefangen
This commit is contained in:
parent
8d0ab1bf7b
commit
9194320d79
@ -31,6 +31,7 @@ public class Board extends JPanel implements KeyListener
|
||||
private long beginTime;
|
||||
private int delayTime = normal;
|
||||
private int deltax = 0;
|
||||
private boolean collision = false;
|
||||
|
||||
|
||||
public Board() {
|
||||
@ -40,6 +41,9 @@ public class Board extends JPanel implements KeyListener
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if(collision){
|
||||
return;
|
||||
}
|
||||
if(!(x + deltax + shape[0].length >11) && !(x + deltax<0))
|
||||
{
|
||||
x +=deltax;
|
||||
@ -47,8 +51,12 @@ public class Board extends JPanel implements KeyListener
|
||||
|
||||
deltax= 0;
|
||||
if(System.currentTimeMillis() -beginTime > delayTime){
|
||||
|
||||
if(!(y+1+shape.length > BOARD_HEIGHT)){
|
||||
y++;
|
||||
}else{
|
||||
collision=true;
|
||||
}
|
||||
|
||||
beginTime=System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user