Documentation
¶
Overview ¶
Package TileSetScenesCollectionSource provides methods for working with TileSetScenesCollectionSource object instances.
Index ¶
- type Advanced
- type Any
- type Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsTileSetScenesCollectionSource() Instance
- func (self Instance) AsTileSetSource() TileSetSource.Instance
- func (self Instance) CreateSceneTile(packed_scene [1]gdclass.PackedScene) int
- func (self Instance) GetNextSceneTileId() int
- func (self Instance) GetSceneTileDisplayPlaceholder(id int) bool
- func (self Instance) GetSceneTileId(index int) int
- func (self Instance) GetSceneTileScene(id int) [1]gdclass.PackedScene
- func (self Instance) GetSceneTilesCount() int
- func (self Instance) HasSceneTileId(id int) bool
- func (self Instance) RemoveSceneTile(id int)
- func (self Instance) SetSceneTileDisplayPlaceholder(id int, display_placeholder bool)
- func (self Instance) SetSceneTileId(id int, new_id int)
- func (self Instance) SetSceneTileScene(id int, packed_scene [1]gdclass.PackedScene)
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Instance ¶
type Instance [1]gdclass.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. [b]Note:[/b] Scene tiles all occupy one tile slot and instead use alternate tile ID to identify scene index. [method TileSetSource.get_tiles_count] will always return [code]1[/code]. Use [method get_scene_tiles_count] to get a number of scenes in a [TileSetScenesCollectionSource]. Use this code if you want to find the scene path at a given tile in [TileMapLayer]: [codeblocks] [gdscript] var source_id = tile_map_layer.get_cell_source_id(Vector2i(x, y)) if source_id > -1:
var scene_source = tile_map_layer.tile_set.get_source(source_id) if scene_source is TileSetScenesCollectionSource: var alt_id = tile_map_layer.get_cell_alternative_tile(Vector2i(x, y)) # The assigned PackedScene. var scene = scene_source.get_scene_tile_scene(alt_id)
[/gdscript] [csharp] int sourceId = tileMapLayer.GetCellSourceId(new Vector2I(x, y)); if (sourceId > -1)
{ TileSetSource source = tileMapLayer.TileSet.GetSource(sourceId); if (source is TileSetScenesCollectionSource sceneSource) { int altId = tileMapLayer.GetCellAlternativeTile(new Vector2I(x, y)); // The assigned PackedScene. PackedScene scene = sceneSource.GetSceneTileScene(altId); } }
[/csharp] [/codeblocks]
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) AsTileSetScenesCollectionSource ¶
func (Instance) AsTileSetSource ¶
func (self Instance) AsTileSetSource() TileSetSource.Instance
func (Instance) CreateSceneTile ¶
func (self Instance) CreateSceneTile(packed_scene [1]gdclass.PackedScene) int
Creates a scene-based tile out of the given scene. Returns a newly generated unique ID.
func (Instance) GetNextSceneTileId ¶
Returns the scene ID a following call to [method create_scene_tile] would return.
func (Instance) GetSceneTileDisplayPlaceholder ¶
Returns whether the scene tile with [param id] displays a placeholder in the editor.
func (Instance) GetSceneTileId ¶
Returns the scene tile ID of the scene tile at [param index].
func (Instance) GetSceneTileScene ¶
func (self Instance) GetSceneTileScene(id int) [1]gdclass.PackedScene
Returns the [PackedScene] resource of scene tile with [param id].
func (Instance) GetSceneTilesCount ¶
Returns the number or scene tiles this TileSet source has.
func (Instance) HasSceneTileId ¶
Returns whether this TileSet source has a scene tile with [param id].
func (Instance) RemoveSceneTile ¶
Remove the scene tile with [param id].
func (Instance) SetSceneTileDisplayPlaceholder ¶
Sets whether or not the scene tile with [param id] should display a placeholder in the editor. This might be useful for scenes that are not visible.
func (Instance) SetSceneTileId ¶
Changes a scene tile's ID from [param id] to [param new_id]. This will fail if there is already a tile with an ID equal to [param new_id].
func (Instance) SetSceneTileScene ¶
func (self Instance) SetSceneTileScene(id int, packed_scene [1]gdclass.PackedScene)
Assigns a [PackedScene] resource to the scene tile with [param id]. This will fail if the scene does not extend CanvasItem, as positioning properties are needed to place the scene on the TileMap.