Beispiel #1
0
 public Boolean isCollisionWithWalls(int changeX, int changeY) {
   for (BlockElement e : this.getBlockElements()) {
     if (e.getX() + changeX >= 10 || e.getX() + changeX < 0) return true;
     if (e.getY() + changeY >= 20) return true;
   }
   return false;
 }
Beispiel #2
0
 public void move(int x, int y) {
   if (!isCollisionWithWalls(x, y)) {
     for (BlockElement e : this.getBlockElements()) {
       e.setX(e.getX() + x);
       e.setY(e.getY() + y);
     }
   }
 }