commit
adc70edf03
After Width: | Height: | Size: 48 KiB |
@ -1,9 +1,12 @@
|
||||
# Tetris
|
||||
|
||||
https://stackoverflow.com/questions/21002224/add-a-background-image-to-shape-in-xml-android
|
||||
|
||||
## Autheur :
|
||||
|
||||
- Enzo Jolys
|
||||
- Alexis Carreau
|
||||
|
||||
## Pièces :
|
||||
|
||||
<img src="./Documentations/tetris-pieces.jpg">
|
||||
|
||||
|
@ -1,35 +1,39 @@
|
||||
package modele
|
||||
|
||||
import android.util.Log
|
||||
import but.androidstudio.tetris.R
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import android.view.InputQueue
|
||||
import views.ViewsGame
|
||||
|
||||
class Game(private val width: Int,private val height: Int,private val viewsGame: ViewsGame) {
|
||||
private val dashBoard: DashBoard = DashBoard(width,height)
|
||||
private var currentShape: Shape? = null
|
||||
private var table: Array<Array<Int>> = arrayOf(arrayOf())
|
||||
|
||||
class Game(private val width: Int,private val height: Int,private val viewGame:ViewsGame) {
|
||||
private val dashBoard: DashBoard = DashBoard(width,height,viewGame)
|
||||
lateinit var currentShape: Shape
|
||||
private var difficulty: Difficulty = Difficulty.EASY
|
||||
|
||||
// To get the current difficulty
|
||||
fun getDifficulty(): Difficulty = this.difficulty
|
||||
|
||||
// To get the current shape on the game
|
||||
fun getCurrentShape(): Shape? = this.currentShape
|
||||
fun getShape():Shape = this.currentShape
|
||||
|
||||
// To set the current shape
|
||||
fun setCurrentShape(newCurrentShape: Shape){
|
||||
fun setShape(newCurrentShape:Shape){
|
||||
this.currentShape = newCurrentShape
|
||||
}
|
||||
|
||||
fun getDashbord():DashBoard = this.dashBoard
|
||||
|
||||
// The start game function
|
||||
|
||||
fun startGame(){
|
||||
Log.d("toto","toto")
|
||||
//this.setCurrentShape(TypeShape.SquareShape)
|
||||
currentShape = Shape(TypeShape(EnumTypeShape.IShape),Position(1,1))
|
||||
|
||||
dashBoard.addShape(currentShape)
|
||||
currentShape.position = dashBoard.moveRight(currentShape)
|
||||
|
||||
|
||||
println(currentShape.position.getX())
|
||||
println(currentShape.position.getY())
|
||||
|
||||
Log.d("toto","toto404")
|
||||
dashBoard.updateViewGame()
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue