class Game(wall: List[(Int, Int)], bounty: List[(Int,Int, Int=> Int)], var playerX: Int, var playerY: Int)
private var field: Array[Array[Boolean]] = Array.ofDim[Boolean](10, 10)
private var bounties: Array[Array[Int=>Int]] = Array.ofDim[Int=>Int](10, 10)
def al() {
playerX = playerX - 1
checkBounty();
if(field(playerX)(playerY) == true) {
playerX = playerX - 0
getPlayerPos();
}
}
Это код для перемещения игрока на одну позицию влево.
I wanna delegate the function above al() into the function al(n: Int) and it should be repeated n amount of times.
can anyone please help me with that?