No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AnimalScene.gd 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. extends "res://util/StatsHandler.gd"
  2. onready var text_container = $MarginContainer
  3. onready var animal_container = $CenterContainer
  4. onready var animal_texture = $CenterContainer/AnimalTexture
  5. onready var animal_name = $MarginContainer/CenterContainer/Panel/MarginContainer/VBoxContainer/Title
  6. onready var animal_description = $MarginContainer/CenterContainer/Panel/MarginContainer/VBoxContainer/Content
  7. onready var tween = $Tween
  8. var animation_played := false
  9. export(Array, Texture) var animals := []
  10. export(Array, String) var names := []
  11. export(Array, String, MULTILINE) var descriptions := []
  12. var max_gauge : String
  13. func _ready() -> void:
  14. var max_gauge = gauges_values.find(gauges_values.max())
  15. if max_gauge < animals.size() and max_gauge < names.size() and max_gauge < descriptions.size():
  16. animal_texture.texture = animals[max_gauge]
  17. animal_name.text = names[max_gauge]
  18. animal_description.text = descriptions[max_gauge]
  19. BackgroundMusic.crossfade_to("res://music/menu_principal.ogg", -10, 1)
  20. func play_start_animation():
  21. tween.interpolate_property(text_container, "rect_position", null, Vector2(0, 0), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
  22. tween.interpolate_property(animal_container, "rect_position", null, Vector2(0, -100), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
  23. tween.interpolate_property(animal_texture, "rect_scale", null, Vector2(0.8, 0.8), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
  24. tween.start()
  25. func _input(event: InputEvent) -> void:
  26. if event.is_action_pressed("dialogic_next"):
  27. if not animation_played:
  28. animation_played = true
  29. play_start_animation()
  30. else:
  31. Transit.change_scene("res://scenes/end-screen/EndRecap.tscn", 2)