All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.almasb.fxgl.entity.level.tiled.TiledMap.kt Maven / Gradle / Ivy

There is a newer version: 21.1
Show newest version
/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB ([email protected]).
 * See LICENSE for details.
 */

package com.almasb.fxgl.entity.level.tiled

/**
 * JSON map format from the Tiled map editor.
 * Tiled version: 1.0.1
 * Specification: http://docs.mapeditor.org/en/latest/reference/json-map-format/
 *
 * @author Almas Baimagambetov ([email protected])
 */
data class TiledMap(
        var width: Int = 0,
        var height: Int = 0,
        var tilewidth: Int = 0,
        var tileheight: Int = 0,
        var orientation: String = "",
        var layers: List = arrayListOf(),
        var tilesets: List = arrayListOf(),
        var backgroundcolor: String = "",
        var renderorder: String = "",
        var nextobjectid: Int = 0,
        var version: Int = 0,
        var tiledversion: String = "",
        var type: String = "",
        var infinite: Boolean = false,
        var hexsidelength: Int = 0,
        var staggeraxis: String = "",
        var staggerindex: String = "",
        var properties: Map = hashMapOf(),
        var propertytypes: Map = hashMapOf()
) {

    fun getLayerByName(name: String) = layers.filter { it.name == name }.firstOrNull()
            ?: throw IllegalArgumentException("Layer with name=$name not found")
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy