From d9775606447e59105d8565f5d8b5f26bf9e495f9 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 20 Nov 2022 01:34:44 +0100 Subject: [PATCH] Merge --- core/src/main/kotlin/com/last/commit/map/Collectible.kt | 5 ++--- core/src/main/kotlin/com/last/commit/map/MapState.kt | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/main/kotlin/com/last/commit/map/Collectible.kt b/core/src/main/kotlin/com/last/commit/map/Collectible.kt index a933216..e7be7d2 100644 --- a/core/src/main/kotlin/com/last/commit/map/Collectible.kt +++ b/core/src/main/kotlin/com/last/commit/map/Collectible.kt @@ -1,16 +1,15 @@ package com.last.commit.map import GameState -import Position import com.badlogic.gdx.math.Rectangle +import com.badlogic.gdx.math.Vector2 import com.last.commit.audio.GameSoundEffect import com.last.commit.inventory.InventoryItem class Collectible( name: String, val pos: Position, - width: Float, - height: Float, + val size: Vector2, val requiredItem: String ) : Interactable { diff --git a/core/src/main/kotlin/com/last/commit/map/MapState.kt b/core/src/main/kotlin/com/last/commit/map/MapState.kt index bfbbbd7..ea95c37 100644 --- a/core/src/main/kotlin/com/last/commit/map/MapState.kt +++ b/core/src/main/kotlin/com/last/commit/map/MapState.kt @@ -75,8 +75,10 @@ class MapState(val map: TiledMap) { return if (obj is RectangleMapObject) { val itemName: String? = obj.properties.get("item", String::class.java) + val requiredItem = obj.properties.get("requiredItem", String::class.java) ?: "" + if (itemName != null) { - Collectible(itemName, Position(coords, gridCoords), size) + Collectible(itemName, Position(coords, gridCoords), size, requiredItem) } else { null }