fix: compilation errors that were caused by the dragonproperties refactoring

This commit is contained in:
Gerard Gascón 2025-04-11 23:52:31 +02:00
parent 46726bca32
commit 50bc814367
14 changed files with 66 additions and 207 deletions

View file

@ -8,11 +8,11 @@ class_name DragonEntity
@export var min_exit_time: float
@export var max_exit_time: float
signal on_pick(dragon_id: int, position: Vector2, hat: Texture2D, shirt: Texture2D, shoes: Texture2D)
signal on_pick(properties: DragonProperties)
signal on_quit(dragon_id: int)
var rng: RandomNumberGenerator = RandomNumberGenerator.new()
var id: int
var properties: DragonProperties
func _ready() -> void:
@ -22,13 +22,13 @@ func _ready() -> void:
func _queue_exit():
await get_tree().create_timer(rng.randf_range(min_exit_time, max_exit_time)).timeout
var tween = get_tree().create_tween()
var tween: Tween = get_tree().create_tween()
tween.tween_property($CollisionShape2D, "position", Vector2(get_window().size.x + 200, 0), animation_duration)
tween.tween_callback(_proceed_exit)
func _proceed_exit():
on_quit.emit(id)
on_quit.emit(properties.id)
queue_free()
@ -39,13 +39,14 @@ func _play_initial_animation() -> void:
tween.tween_callback(_queue_exit)
func _input_event(viewport, event, shape_idx) -> void:
func _input_event(_viewport, event, _shape_idx) -> void:
if event is InputEventMouseButton \
and event.button_index == MOUSE_BUTTON_LEFT \
and event.is_pressed():
on_pick.emit(id, position + $CollisionShape2D.position, dragon.hat.texture, dragon.shirt.texture, dragon.shoes.texture)
properties.position = position + $CollisionShape2D.position
on_pick.emit(properties)
queue_free()
func dress(hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
dragon.dress(hat, shirt, shoes)
func dress(properties: DragonProperties):
dragon.dress(properties)