player_spawn.gd
extends Node2D
const CLOWN_NOSE = preload("res://scenes/clown_nose/clown_nose.tscn")
func _ready():
var new_clown_nose = CLOWN_NOSE.instantiate()
add_child(new_clown_nose)Published on 12/17/2025
Implement player spawn points from LDtk.
extends Node2D
const CLOWN_NOSE = preload("res://scenes/clown_nose/clown_nose.tscn")
func _ready():
var new_clown_nose = CLOWN_NOSE.instantiate()
add_child(new_clown_nose)extends Node2D
func _ready():
connect('body_entered', _on_body_entered)
func _on_body_entered(body):
print('Next level!')@tool
const PLAYER_SPAWN = preload("res://scenes/player_spawn/player_spawn.tscn")
const EXIT = preload("res://scenes/exit/exit.tscn")
const ENTITY_SCENES := {
'PlayerSpawn': PLAYER_SPAWN,
'Exit': EXIT,
}
func post_import(entity_layer: LDTKEntityLayer) -> LDTKEntityLayer:
var definition: Dictionary = entity_layer.definition
var grid_size: float = definition['gridSize']
var entities: Array = entity_layer.entities
for entity in entities:
var entity_scene: PackedScene = ENTITY_SCENES[entity.identifier]
if entity_scene:
var new_entity = entity_scene.instantiate()
new_entity.scale = entity.size / grid_size
var tile_offset := Vector2(grid_size, grid_size) / 2
new_entity.global_position = Vector2(entity.position) \
+ tile_offset * new_entity.scale
entity_layer.add_child(new_entity)
return entity_layer← Small Spawn Fix in LDtk · Optional Sizing Assignment Challenge →