Merge with mehdis changes

viewport-stuff
trivernis 2 years ago
parent 4fdee63537
commit 0a0e5334b5
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -254,15 +254,17 @@ class FirstScreen(val gameState: GameState) : Screen, InputProcessor {
override fun keyTyped(character: Char): Boolean {
val keyCode = character.code
if (game.settings.isInteractPressed(keyCode)) {
if (gameState.settings.isInteractPressed(keyCode)) {
openDoor()
} else if (game.settings.isTimeTravelPressed(keyCode)) {
} else if (gameState.settings.isTimeTravelPressed(keyCode)) {
map.teleport(player)
} else if (game.settings.isOpenInventoryPressed(keyCode)) {
} else if (gameState.settings.isOpenInventoryPressed(keyCode)) {
inventoryStage.visible = !inventoryStage.visible
} else if (character == 'p') {
player.inventory.add("compass")
gameState.inventory.add("compass")
inventoryStage.refresh()
} else if (gameState.settings.isInteractPressed(keyCode)) {
this.openDoor()
}
return false
}

@ -2,6 +2,7 @@ package com.last.commit
import com.badlogic.gdx.Game
import com.last.commit.inventory.Inventory
import com.last.commit.config.PlayerSettings
import GameState
/** [com.badlogic.gdx.ApplicationListener] implementation shared by all platforms. */
@ -9,17 +10,15 @@ class Game : Game() {
private lateinit var state: GameState
var settings = PlayerSettings()
override fun create() {
setScreen(FirstScreen(this))
createState()
setScreen(FirstScreen(state))
}
fun createState() {
state = GameState(
Inventory()
Inventory(),
PlayerSettings()
)
}
}

@ -1,5 +1,7 @@
import com.last.commit.inventory.Inventory
import com.last.commit.config.PlayerSettings
public data class GameState(
public val inventory: Inventory,
public val settings: PlayerSettings,
)
Loading…
Cancel
Save