From f0f68a172f7b4b50b2fdbea636fa11f7e1c74f65 Mon Sep 17 00:00:00 2001 From: Srikavin Ramkumar Date: Thu, 9 Jan 2020 10:22:54 -0500 Subject: [PATCH] Update assets path --- .../me/srikavin/fbla/game/map/MapLoader.kt | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/core/src/me/srikavin/fbla/game/map/MapLoader.kt b/core/src/me/srikavin/fbla/game/map/MapLoader.kt index f3d7b11..e221059 100644 --- a/core/src/me/srikavin/fbla/game/map/MapLoader.kt +++ b/core/src/me/srikavin/fbla/game/map/MapLoader.kt @@ -52,8 +52,8 @@ class MapLoader { private val playerAnimations = spritesheetLoader.loadAsespriteSheet("assets/graphics/characters/David.png", "assets/graphics/characters/David.json") private val coinSprite: TextureRegion = TextureRegion(Texture(Gdx.files.internal("assets/graphics/entity/coinGold.png"))) - private val defaultTriggerProcessor: TriggerProcessor = { mapObject, _, path -> - error { throw RuntimeException("Spawn is of type ${mapObject.javaClass.name} instead of RectangleMapObject in $path") } + private val defaultTriggerProcessor: TriggerProcessor = { _, type, _ -> + error { throw RuntimeException("Unknown trigger type $type") } } enum class UnloadType { @@ -179,22 +179,22 @@ class MapLoader { createCoin(world, mapObject.rectangle.getPosition(pos).scl(MAP_SCALE_FACTOR)) info { "Making coin at $pos" } } - TriggerType.values().any { it.name == type.toUpperCase() } -> { - val rect = mapObject.rectangle - - world.createEntity().edit() - .add(Transform().apply { position = rect.getCenter(recycledVector2).scl(MAP_SCALE_FACTOR).cpy() }) - .add(PhysicsBody().apply { - shape = PolygonShape().apply { - setAsBox(rect.width * MAP_SCALE_FACTOR * .5f, rect.height * MAP_SCALE_FACTOR * .5f, - recycledVector2.setZero(), 0f) - } - this.type = BodyDef.BodyType.StaticBody - }) - .add(MapTrigger().apply { - this.type = TriggerType.valueOf(type.toUpperCase()) - properties = mapObject.properties - }) + type == "damage" -> { +// val rect = mapObject.rectangle + +// world.createEntity().edit() +// .add(Transform().apply { position = rect.getCenter(recycledVector2).scl(MAP_SCALE_FACTOR).cpy() }) +// .add(PhysicsBody().apply { +// shape = PolygonShape().apply { +// setAsBox(rect.width * MAP_SCALE_FACTOR * .5f, rect.height * MAP_SCALE_FACTOR * .5f, +// recycledVector2.setZero(), 0f) +// } +// this.type = BodyDef.BodyType.StaticBody +// }) +// .add(MapTrigger().apply { +// this.type = TriggerType.valueOf(type.toUpperCase()) +// properties = mapObject.properties +// }) } else -> { customTriggerProcessor(mapObject, type, path)