|
|
|
@ -1,6 +1,9 @@
|
|
|
|
|
package modele
|
|
|
|
|
|
|
|
|
|
import android.view.InputQueue
|
|
|
|
|
import android.util.Log
|
|
|
|
|
import kotlinx.coroutines.GlobalScope
|
|
|
|
|
import kotlinx.coroutines.cancel
|
|
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
|
import views.ViewsGame
|
|
|
|
|
|
|
|
|
|
class Game(private val width: Int,private val height: Int,private val viewGame:ViewsGame) {
|
|
|
|
@ -15,18 +18,6 @@ class Game(private val width: Int,private val height: Int,private val viewGame:V
|
|
|
|
|
|
|
|
|
|
fun startGame(){
|
|
|
|
|
//this.setCurrentShape(TypeShape.SquareShape)
|
|
|
|
|
currentShape = Shape(TypeShape(EnumTypeShape.IShape),Position(2,5))
|
|
|
|
|
dashBoard.addShape(currentShape)
|
|
|
|
|
|
|
|
|
|
currentShape = Shape(TypeShape(EnumTypeShape.SquareShape),Position(2,6))
|
|
|
|
|
dashBoard.addShape(currentShape)
|
|
|
|
|
|
|
|
|
|
currentShape = Shape(TypeShape(EnumTypeShape.TShape),Position(2,8))
|
|
|
|
|
dashBoard.addShape(currentShape)
|
|
|
|
|
|
|
|
|
|
currentShape = Shape(TypeShape(EnumTypeShape.ZShape),Position(2,10))
|
|
|
|
|
dashBoard.addShape(currentShape)
|
|
|
|
|
|
|
|
|
|
currentShape = Shape(TypeShape(EnumTypeShape.SShape),Position(1,1))
|
|
|
|
|
dashBoard.addShape(currentShape)
|
|
|
|
|
|
|
|
|
@ -34,10 +25,13 @@ class Game(private val width: Int,private val height: Int,private val viewGame:V
|
|
|
|
|
dashBoard.gridOfGame[1][0] = 2
|
|
|
|
|
dashBoard.gridOfGame[1][6] = 3
|
|
|
|
|
|
|
|
|
|
//println(currentShape.position.getX())
|
|
|
|
|
//println(currentShape.position.getY())
|
|
|
|
|
println("RUN !!")
|
|
|
|
|
dashBoard.updateViewGame()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GlobalScope.launch {
|
|
|
|
|
while (true){
|
|
|
|
|
dashBoard.fallingShape(currentShape)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|