Mise à jour de 'Tetris/app/src/main/java/modele/DashBoard.kt'

pull/8/head
Enzo JOLYS 2 years ago
parent f63d8b067f
commit c87cea5ec1

@ -99,9 +99,9 @@ class DashBoard(private val width: Int,private val height: Int,private val view:
limite = limiteInitial limite = limiteInitial
} }
for ( line in 0..3){ // Check si le décalage est possible for ( line in 0..limite){ // Check si le décalage est possible
for ( column in 0..3){ for ( column in 0..limite){
if ( column != 3) { if ( column != limite) {
if ((shape.typeShape.showShape[line][column] == 1) if ((shape.typeShape.showShape[line][column] == 1)
and (shape.typeShape.showShape[line][column + 1] == 0) and (shape.typeShape.showShape[line][column + 1] == 0)
and (gridOfGame[shape.position.getX() + line][shape.position.getY() + column + 1] == 1) and (gridOfGame[shape.position.getX() + line][shape.position.getY() + column + 1] == 1)
@ -126,6 +126,19 @@ class DashBoard(private val width: Int,private val height: Int,private val view:
return shape.position return shape.position
} }
fun moveLeft(shape:Shape):Position{
// Check if X == 0
if ( shape.position.getX() == 0 ){
return shape.position
}
for( i in )
return shape.position
}
// Delete a shape in gridOfGame // Delete a shape in gridOfGame
private fun deleteShape(shape: Shape){ private fun deleteShape(shape: Shape){
for (line in 0..3) { for (line in 0..3) {

Loading…
Cancel
Save