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