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

pull/8/head
Enzo JOLYS 2 years ago
parent bd3910f9f9
commit 09d5921d75

@ -89,10 +89,14 @@ class DashBoard(private val width: Int,private val height: Int,private val view:
// ATTENTION ELLE BUG PAS DE COLLISION
fun moveRight(shape:Shape):Position{
//Check les limite du tableau à droite !!!! NE MARCHE PAS ATTENTION !!!
var limite = width-shape.position.getX()
if (limite >= 4 ){
//Check les limite du tableau à droite !!!! A vérifier que ca marche !!!
var limiteInitial = width-shape.position.getX()
var limite:Int = 0
if (limiteInitial >= 4 ){
limite = 4
}else {
limite = limiteInitial
}
for ( line in 0..3){ // Check si le décalage est possible
@ -105,8 +109,10 @@ class DashBoard(private val width: Int,private val height: Int,private val view:
return shape.position
}
}else{
if ( limite == limiteInitial and shape.typeShape.showShape[line][column] == 1){
return shape.position
}
if ((shape.typeShape.showShape[line][column] == 1)
and (shape.typeShape.showShape[line][column] == 0)
and (gridOfGame[shape.position.getX() + line][shape.position.getY() + column + 1] == 1)
) {
return shape.position

Loading…
Cancel
Save