TileSetScenesCollectionSource
Exposes a set of scenes as tiles for a TileSet
resource.
class TileSetScenesCollectionSource
When placed on a TileMap
, tiles from TileSetScenesCollectionSource
will automatically instantiate an associated scene at the cell’s position in the TileMap.
Scenes are instantiated as children of the TileMap
when it enters the tree. If you add/remove a scene tile in the TileMap
that is already inside the tree, the TileMap
will automatically instantiate/free the scene accordingly.
Superclasses
class TileSetSource
Exposes a set of tiles for a
TileSet
resource.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
func createSceneTile(packedScene: PackedScene?, idOverride: Int32
) -> Int32 Creates a scene-based tile out of the given scene.
func getNextSceneTileId(
) -> Int32 Returns the scene ID a following call to
createSceneTile(packedScene:idOverride:)
would return.func getSceneTileDisplayPlaceholder(id: Int32
) -> Bool Returns whether the scene tile with
id
displays a placeholder in the editor.func getSceneTileId(index: Int32
) -> Int32 Returns the scene tile ID of the scene tile at
index
.func getSceneTileScene(id: Int32
) -> PackedScene? Returns the
PackedScene
resource of scene tile withid
.func getSceneTilesCount(
) -> Int32 Returns the number or scene tiles this TileSet source has.
func hasSceneTileId(Int32
) -> Bool Returns whether this TileSet source has a scene tile with
id
.func removeSceneTile(id: Int32
) Remove the scene tile with
id
.func setSceneTileDisplayPlaceholder(id: Int32, displayPlaceholder: Bool
) Sets whether or not the scene tile with
id
should display a placeholder in the editor. This might be useful for scenes that are not visible.func setSceneTileId(Int32, newId: Int32
) Changes a scene tile’s ID from
id
tonewId
. This will fail if there is already a tile with an ID equal tonewId
.func setSceneTileScene(id: Int32, packedScene: PackedScene?
) Assigns a
PackedScene
resource to the scene tile withid
. This will fail if the scene does not extend CanvasItem, as positioning properties are needed to place the scene on the TileMap.