added PlayerSettings.kt to Player.kt

viewport-stuff
MehdiAyadi 2 years ago
parent 796f2bead0
commit 7e5590c901

@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.math.Rectangle
import com.badlogic.gdx.math.Vector2
import com.last.commit.config.PlayerSettings
import com.last.commit.inventory.Inventory
@ -14,6 +15,7 @@ class Player(private val textureRegion: TextureRegion) : Collidable {
private var direction = Vector2.Zero
private val movementSpeed = 200f
private val interactionRange = 60f
private val settings = PlayerSettings()
val inventory = Inventory()

@ -17,12 +17,12 @@ open class Wall(var gridX: Int, var gridY: Int, wallCollider: Rectangle, cell: C
}
fun collidesWidth(collidable: Collidable): Boolean {
return if (isCollidable) {
return if (isColidable) {
wallCollider.overlaps(collidable.getCollider())
} else false
}
open val isCollidable: Boolean
open val isColidable: Boolean
get() = true
override fun toString(): String {

@ -0,0 +1,13 @@
package com.last.commit.config
enum class ActionCommand {
//move
UP, DOWN, LEFT, RIGHT,
//interaction
OPEN_INVENTORY, TIME_TRAVEL,
//program interaction
OPEN_MENU
}

@ -0,0 +1,23 @@
package com.last.commit.config
import com.badlogic.gdx.Input.Keys
import java.util.*
import javax.swing.Action
class PlayerSettings {
val fullscreen: Boolean = false
val actionKeys: EnumMap<ActionCommand, List<Int>> = EnumMap(ActionCommand::class.java)
init {
actionKeys[ActionCommand.UP] = listOf(Keys.UP, Keys.W)
actionKeys[ActionCommand.DOWN] = listOf(Keys.DOWN, Keys.S)
actionKeys[ActionCommand.LEFT] = listOf(Keys.LEFT, Keys.A)
actionKeys[ActionCommand.RIGHT] = listOf(Keys.RIGHT, Keys.D)
actionKeys[ActionCommand.OPEN_MENU] = listOf(Keys.ESCAPE)
actionKeys[ActionCommand.OPEN_INVENTORY] = listOf(Keys.I, Keys.A)
actionKeys[ActionCommand.TIME_TRAVEL] = listOf(Keys.T)
}
}
Loading…
Cancel
Save