Skip to content

Commit

Permalink
Update assets path
Browse files Browse the repository at this point in the history
  • Loading branch information
srikavin committed Jan 9, 2020
1 parent e5d7f0f commit f0f68a1
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions core/src/me/srikavin/fbla/game/map/MapLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f0f68a1

Please sign in to comment.