/* ***************************************************************************************** AUTHOR: Simona Pappalardo MAIL: pacana@libero.it * *****************************************************************************************/ import java.lang.*; import java.awt.*; public class Base { int coordX[]; int oldCoordX[]; int coordY[]; int oldCoordY[]; int nr_punti; int riga; int colonna; int coordCorrX[]; int coordCorrY[]; int[] color; static int cont=0; boolean gameOver = false; boolean fine = false; boolean disegna=true; int maxX; int maxY; int xc; int yc; int appletX = 100; int appletY = 50; static boolean aggiorna=false; static boolean modifica_punteggio=false; public boolean end() { for (int i=0;i=0;k--) // for every row which overwhelm the i-th full row // If I found a busy little square, I shift it to the bottom if(Tetrisgame.griglia[j][k].occupato != 0) { Tetrisgame.griglia[j][k+1].occupato = 1; Tetrisgame.griglia[j][k+1].color[0] = Tetrisgame.griglia[j][k].color[0]; Tetrisgame.griglia[j][k+1].color[1] = Tetrisgame.griglia[j][k].color[1]; Tetrisgame.griglia[j][k+1].color[2] = Tetrisgame.griglia[j][k].color[2]; } else /* * If, otherwise, the little square is free, I shift it to the bottom, setting * its color to the applet background, making the square free. */ { Tetrisgame.griglia[j][k+1].occupato = 0; Tetrisgame.griglia[j][k+1].color[0] = AppletEnglish.color.getRed(); Tetrisgame.griglia[j][k+1].color[1] = AppletEnglish.color.getGreen(); Tetrisgame.griglia[j][k+1].color[2] = AppletEnglish.color.getBlue(); } i = 0; // If I found a full row - say r - I have to look for others // full rows since r erasing could complete others rows. AppletEnglish.punteggio += 10; modifica_punteggio = true; Tetrisgame.rigaPiena = true; System.out.println("Punteggio:"+AppletEnglish.punteggio); } } } synchronized boolean ifFallDown() {return gameOver;} public boolean checkNewCoord() {return disegna;} synchronized boolean anticlockwiseRotation() { // compute rotations coordinates for(int i=0;i(this.maxX*10) || (this.coordY[i]-appletY)>(this.maxY*10)) { this.disegna = false; return this.disegna; } // call the custom procedure implemented in class Pezzo# which has to check // if the new computed rotation coordinates fit into busy block. this.disegna = this.checkNewCoord(); if (!this.disegna) return this.disegna; // if I'm here it means that the new coordinates neither goes accross applet // boundaries nor fit into busy little squares. for(int i=0;i(this.maxX*10) || (this.coordY[i]-appletY)>(this.maxY*10)) { this.disegna = false; return this.disegna; } this.disegna = this.checkNewCoord(); if (!this.disegna) return this.disegna; for(int i=0;i(this.maxX*10) ) { this.disegna = false; return this.disegna; } this.disegna = this.checkNewCoord(); if(!this.disegna) return this.disegna; for(int i=0;i= 2) return false; for(int i=0;i=this.maxY) { // if applet lower bound is reached, the computed coordinates are the ones that have to be painted. this.disegna = true; for(int j=0;j