feat: This enables user-defined transition and uses a tween to animate the transitions (#405)
* feat: This enables user-defined transition and uses a tween to animate the transitions fixes #344 * docs: Automatic update of API docs * docs: Automatic update of API docs Co-authored-by: Dennis Ploeger <develop@dieploegers.de> Co-authored-by: dploeger <dploeger@users.noreply.github.com>
This commit is contained in:
@@ -63,7 +63,10 @@ func run(command_params: Array) -> int:
|
|||||||
escoria.event_manager.interrupt_running_event()
|
escoria.event_manager.interrupt_running_event()
|
||||||
|
|
||||||
if !command_params[1]:
|
if !command_params[1]:
|
||||||
escoria.main.scene_transition.transition_out()
|
escoria.main.scene_transition.transition(
|
||||||
|
"",
|
||||||
|
ESCTransitionPlayer.TRANSITION_MODE.OUT
|
||||||
|
)
|
||||||
yield(escoria.main.scene_transition, "transition_done")
|
yield(escoria.main.scene_transition, "transition_done")
|
||||||
|
|
||||||
escoria.inputs_manager.clear_stack()
|
escoria.inputs_manager.clear_stack()
|
||||||
@@ -109,7 +112,7 @@ func run(command_params: Array) -> int:
|
|||||||
return rc[0]
|
return rc[0]
|
||||||
|
|
||||||
if !command_params[1]:
|
if !command_params[1]:
|
||||||
escoria.main.scene_transition.transition_in()
|
escoria.main.scene_transition.transition()
|
||||||
yield(escoria.main.scene_transition, "transition_done")
|
yield(escoria.main.scene_transition, "transition_done")
|
||||||
|
|
||||||
if script.events.has("ready"):
|
if script.events.has("ready"):
|
||||||
@@ -122,7 +125,7 @@ func run(command_params: Array) -> int:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if !command_params[1]:
|
if !command_params[1]:
|
||||||
escoria.main.scene_transition.transition_in()
|
escoria.main.scene_transition.transition()
|
||||||
yield(escoria.main.scene_transition, "transition_done")
|
yield(escoria.main.scene_transition, "transition_done")
|
||||||
|
|
||||||
# Clear queued resources
|
# Clear queued resources
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
# `transition transition_name in|out`
|
# `transition transition_name in|out [delay]`
|
||||||
#
|
#
|
||||||
# Performs a transition in our out manually.
|
# Performs a transition in our out manually.
|
||||||
#
|
#
|
||||||
|
# Parameters:
|
||||||
|
# - transition_name: Name of the transition shader from one of the transition
|
||||||
|
# directories
|
||||||
|
# - in|out: Wether to play the transition in IN- or OUT-mode
|
||||||
|
# - delay: Delay for the transition to take. Defaults to 1 second
|
||||||
|
#
|
||||||
# @ESC
|
# @ESC
|
||||||
extends ESCBaseCommand
|
extends ESCBaseCommand
|
||||||
class_name TransitionCommand
|
class_name TransitionCommand
|
||||||
@@ -11,8 +17,8 @@ class_name TransitionCommand
|
|||||||
func configure() -> ESCCommandArgumentDescriptor:
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
return ESCCommandArgumentDescriptor.new(
|
return ESCCommandArgumentDescriptor.new(
|
||||||
2,
|
2,
|
||||||
[TYPE_STRING, TYPE_STRING],
|
[TYPE_STRING, TYPE_STRING, TYPE_REAL],
|
||||||
[null, null]
|
[null, null, 1.0]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +45,14 @@ func validate(arguments: Array):
|
|||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
func run(command_params: Array) -> int:
|
func run(command_params: Array) -> int:
|
||||||
var transition_player = escoria.main.scene_transition
|
escoria.main.scene_transition.transition(
|
||||||
transition_player.call("transition_%s" % command_params[1], command_params[0])
|
command_params[0],
|
||||||
var animation_finished = yield(transition_player, "transition_done")
|
ESCTransitionPlayer.TRANSITION_MODE.OUT if command_params[1] == "out" \
|
||||||
|
else ESCTransitionPlayer.TRANSITION_MODE.IN,
|
||||||
|
command_params[2]
|
||||||
|
)
|
||||||
|
yield(
|
||||||
|
escoria.main.scene_transition,
|
||||||
|
"transition_done"
|
||||||
|
)
|
||||||
return ESCExecution.RC_OK
|
return ESCExecution.RC_OK
|
||||||
|
|||||||
@@ -18,11 +18,13 @@ var current_scene: Node
|
|||||||
var wait_level
|
var wait_level
|
||||||
|
|
||||||
# Reference to the scene transition node
|
# Reference to the scene transition node
|
||||||
onready var scene_transition = $layers/curtain/scene_transition
|
onready var scene_transition: ESCTransitionPlayer
|
||||||
|
|
||||||
|
|
||||||
# Connect the wait timer event
|
# Connect the wait timer event
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
scene_transition = ESCTransitionPlayer.new()
|
||||||
|
$layers/curtain.add_child(scene_transition)
|
||||||
$layers/wait_timer.connect("timeout", self, "_on_wait_finished")
|
$layers/wait_timer.connect("timeout", self, "_on_wait_finished")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/escoria-core/game/main.gd" type="Script" id=1]
|
[ext_resource path="res://addons/escoria-core/game/main.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/escoria-core/game/scenes/esc_prompt/esc_prompt_popup.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/escoria-core/game/scenes/esc_prompt/esc_prompt_popup.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/escoria-core/game/scenes/sound/esc_music_player.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://addons/escoria-core/game/scenes/sound/esc_music_player.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://addons/escoria-core/game/scenes/transitions/transition.tscn" type="PackedScene" id=4]
|
|
||||||
[ext_resource path="res://addons/escoria-core/game/scenes/sound/esc_sound_player.tscn" type="PackedScene" id=5]
|
[ext_resource path="res://addons/escoria-core/game/scenes/sound/esc_sound_player.tscn" type="PackedScene" id=5]
|
||||||
[ext_resource path="res://addons/escoria-core/game/scenes/sound/esc_speech_player.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://addons/escoria-core/game/scenes/sound/esc_speech_player.tscn" type="PackedScene" id=6]
|
||||||
|
|
||||||
@@ -15,8 +14,6 @@ script = ExtResource( 1 )
|
|||||||
[node name="curtain" type="CanvasLayer" parent="layers"]
|
[node name="curtain" type="CanvasLayer" parent="layers"]
|
||||||
layer = 20
|
layer = 20
|
||||||
|
|
||||||
[node name="scene_transition" parent="layers/curtain" instance=ExtResource( 4 )]
|
|
||||||
|
|
||||||
[node name="menu" type="CanvasLayer" parent="layers"]
|
[node name="menu" type="CanvasLayer" parent="layers"]
|
||||||
|
|
||||||
[node name="wait_timer" type="Timer" parent="layers"]
|
[node name="wait_timer" type="Timer" parent="layers"]
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
# A transition player for scene changes
|
||||||
|
extends ColorRect
|
||||||
|
class_name ESCTransitionPlayer
|
||||||
|
|
||||||
|
# Emitted when the transition was played
|
||||||
|
signal transition_done
|
||||||
|
|
||||||
|
|
||||||
|
# The valid transition modes
|
||||||
|
enum TRANSITION_MODE {
|
||||||
|
IN,
|
||||||
|
OUT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# The tween instance to animate
|
||||||
|
var _tween: Tween
|
||||||
|
|
||||||
|
# If the current tween was canceled
|
||||||
|
var _was_canceled: bool = false
|
||||||
|
|
||||||
|
|
||||||
|
# Fade in when the scene is starting
|
||||||
|
func _ready() -> void:
|
||||||
|
anchor_left = 0
|
||||||
|
anchor_top = 0
|
||||||
|
anchor_right = 1
|
||||||
|
anchor_bottom = 1
|
||||||
|
color = Color.white
|
||||||
|
mouse_filter = MOUSE_FILTER_IGNORE
|
||||||
|
_tween = Tween.new()
|
||||||
|
add_child(_tween)
|
||||||
|
_tween.connect("tween_all_completed", self, "_on_tween_completed")
|
||||||
|
|
||||||
|
transition()
|
||||||
|
|
||||||
|
|
||||||
|
# Play a transition animation
|
||||||
|
#
|
||||||
|
# ## Parameters
|
||||||
|
#
|
||||||
|
# - transition_name: name of the transition to play (if empty string, uses
|
||||||
|
# the default transition)
|
||||||
|
# - mode: Mode to transition (in/out)
|
||||||
|
# - duration: The duration the transition should take
|
||||||
|
func transition(
|
||||||
|
transition_name: String = "",
|
||||||
|
mode: int = TRANSITION_MODE.IN,
|
||||||
|
duration: float = 1.0
|
||||||
|
) -> void:
|
||||||
|
if not has_transition(transition_name):
|
||||||
|
escoria.logger.report_errors(
|
||||||
|
"transition: Transition %s not found" % transition_name,
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
|
||||||
|
material = ResourceLoader.load(get_transition(transition_name))
|
||||||
|
|
||||||
|
var start = 0
|
||||||
|
var end = 1
|
||||||
|
|
||||||
|
if mode == TRANSITION_MODE.OUT:
|
||||||
|
start = 1
|
||||||
|
end = 0
|
||||||
|
|
||||||
|
if _tween.is_active():
|
||||||
|
_was_canceled = true
|
||||||
|
_tween.stop_all()
|
||||||
|
_tween.remove_all()
|
||||||
|
|
||||||
|
_tween.interpolate_property(
|
||||||
|
$".",
|
||||||
|
"material:shader_param/cutoff",
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
duration
|
||||||
|
)
|
||||||
|
_was_canceled = false
|
||||||
|
_tween.start()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Returns the full path for a transition shader based on its name
|
||||||
|
#
|
||||||
|
# ## Parameters
|
||||||
|
#
|
||||||
|
# - name: The name of the transition to test
|
||||||
|
#
|
||||||
|
# *Returns* the full path to the shader or an empty string, if it can't be found
|
||||||
|
func get_transition(name: String) -> String:
|
||||||
|
if name.empty():
|
||||||
|
name = ProjectSettings.get_setting(
|
||||||
|
"escoria/ui/default_transition"
|
||||||
|
)
|
||||||
|
for directory in ProjectSettings.get_setting("escoria/ui/transition_paths"):
|
||||||
|
if ResourceLoader.exists(directory.plus_file("%s.material" % name)):
|
||||||
|
return directory.plus_file("%s.material" % name)
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
# Returns true whether the transition scene has a transition corresponding
|
||||||
|
# to name provided.
|
||||||
|
#
|
||||||
|
# ## Parameters
|
||||||
|
#
|
||||||
|
# - name: The name of the transition to test
|
||||||
|
#
|
||||||
|
# *Returns* true if a transition exists with given name.
|
||||||
|
func has_transition(name: String) -> bool:
|
||||||
|
return not get_transition(name) == ""
|
||||||
|
|
||||||
|
|
||||||
|
func _on_tween_completed():
|
||||||
|
if not _was_canceled:
|
||||||
|
emit_signal("transition_done")
|
||||||
|
_tween.stop_all()
|
||||||
|
_tween.remove_all()
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,68 +0,0 @@
|
|||||||
# A transition player for scene changes
|
|
||||||
extends ColorRect
|
|
||||||
|
|
||||||
# Emitted when the transition was played
|
|
||||||
signal transition_done
|
|
||||||
|
|
||||||
|
|
||||||
# The name of the default transition to play
|
|
||||||
export(
|
|
||||||
String,
|
|
||||||
"fade_black",
|
|
||||||
"fade_white",
|
|
||||||
"curtain"
|
|
||||||
) var transition_name: String
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Reference to the _AnimationPlayer_ node
|
|
||||||
onready var _anim_player := $AnimationPlayer
|
|
||||||
|
|
||||||
|
|
||||||
# Fade in when the scene is starting
|
|
||||||
func _ready() -> void:
|
|
||||||
transition_in()
|
|
||||||
|
|
||||||
|
|
||||||
# Transition out
|
|
||||||
#
|
|
||||||
# ## Parameters
|
|
||||||
#
|
|
||||||
# - p_transition_name: name of the transition to play (if empty string, uses
|
|
||||||
# the default transition)
|
|
||||||
func transition_out(p_transition_name: String = "") -> void:
|
|
||||||
if p_transition_name.empty():
|
|
||||||
_anim_player.play_backwards(transition_name)
|
|
||||||
else:
|
|
||||||
_anim_player.play_backwards(p_transition_name)
|
|
||||||
yield(_anim_player, "animation_finished")
|
|
||||||
emit_signal("transition_done")
|
|
||||||
_anim_player.seek(0.0)
|
|
||||||
|
|
||||||
|
|
||||||
# Transition in
|
|
||||||
#
|
|
||||||
# ## Parameters
|
|
||||||
#
|
|
||||||
# - p_transition_name: name of the transition to play (if empty string, uses
|
|
||||||
# the default transition)
|
|
||||||
func transition_in(p_transition_name: String = "") -> void:
|
|
||||||
if p_transition_name.empty():
|
|
||||||
_anim_player.play(transition_name)
|
|
||||||
else:
|
|
||||||
_anim_player.play(p_transition_name)
|
|
||||||
yield(_anim_player, "animation_finished")
|
|
||||||
emit_signal("transition_done")
|
|
||||||
_anim_player.seek(0.0)
|
|
||||||
|
|
||||||
|
|
||||||
# Returns true whether the transition scene has a transition corresponding
|
|
||||||
# to name provided.
|
|
||||||
#
|
|
||||||
# ## Parameters
|
|
||||||
#
|
|
||||||
# - p_name: The name of the transition to test
|
|
||||||
#
|
|
||||||
# *Returns* true if a transition exists with given name.
|
|
||||||
func has_transition(p_name: String) -> bool:
|
|
||||||
return _anim_player.has_animation(p_name)
|
|
||||||
@@ -1,124 +1,7 @@
|
|||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/escoria-core/game/scenes/transitions/transition.gd" type="Script" id=1]
|
[ext_resource path="res://addons/escoria-core/game/scenes/transitions/esc_transition_player.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/escoria-core/game/scenes/transitions/shaders/transition.material" type="Material" id=2]
|
[ext_resource path="res://addons/escoria-core/game/scenes/transitions/shaders/curtain.material" type="Material" id=2]
|
||||||
|
|
||||||
[sub_resource type="Animation" id=1]
|
|
||||||
resource_name = "curtain"
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/path = NodePath(".:material:shader_param/cutoff")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PoolRealArray( 0, 1 ),
|
|
||||||
"transitions": PoolRealArray( 1, 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ 0.0, 1.0 ]
|
|
||||||
}
|
|
||||||
tracks/1/type = "value"
|
|
||||||
tracks/1/path = NodePath(".:material:shader_param/color")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PoolRealArray( 0 ),
|
|
||||||
"transitions": PoolRealArray( 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ Color( 0, 0, 0, 1 ) ]
|
|
||||||
}
|
|
||||||
tracks/2/type = "value"
|
|
||||||
tracks/2/path = NodePath(".:modulate")
|
|
||||||
tracks/2/interp = 1
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"times": PoolRealArray( 0 ),
|
|
||||||
"transitions": PoolRealArray( 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ Color( 1, 1, 1, 1 ) ]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id=2]
|
|
||||||
length = 0.5
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/path = NodePath(".:modulate")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PoolRealArray( 0, 0.5 ),
|
|
||||||
"transitions": PoolRealArray( 1, 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ Color( 0, 0, 0, 0 ), Color( 0, 0, 0, 1 ) ]
|
|
||||||
}
|
|
||||||
tracks/1/type = "value"
|
|
||||||
tracks/1/path = NodePath(".:material:shader_param/cutoff")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PoolRealArray( 0 ),
|
|
||||||
"transitions": PoolRealArray( 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ 0.0 ]
|
|
||||||
}
|
|
||||||
tracks/2/type = "value"
|
|
||||||
tracks/2/path = NodePath(".:material:shader_param/color")
|
|
||||||
tracks/2/interp = 1
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"times": PoolRealArray( 0 ),
|
|
||||||
"transitions": PoolRealArray( 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ Color( 0, 0, 0, 1 ) ]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id=3]
|
|
||||||
length = 0.5
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/path = NodePath(".:modulate")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PoolRealArray( 0, 0.5 ),
|
|
||||||
"transitions": PoolRealArray( 1, 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
|
|
||||||
}
|
|
||||||
tracks/1/type = "value"
|
|
||||||
tracks/1/path = NodePath(".:material:shader_param/cutoff")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PoolRealArray( 0 ),
|
|
||||||
"transitions": PoolRealArray( 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ 0.0 ]
|
|
||||||
}
|
|
||||||
tracks/2/type = "value"
|
|
||||||
tracks/2/path = NodePath(".:material:shader_param/color")
|
|
||||||
tracks/2/interp = 1
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"times": PoolRealArray( 0 ),
|
|
||||||
"transitions": PoolRealArray( 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ Color( 1, 1, 1, 1 ) ]
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="scene_transition" type="ColorRect"]
|
[node name="scene_transition" type="ColorRect"]
|
||||||
material = ExtResource( 2 )
|
material = ExtResource( 2 )
|
||||||
@@ -129,9 +12,5 @@ script = ExtResource( 1 )
|
|||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
transition_name = "curtain"
|
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="Tween" type="Tween" parent="."]
|
||||||
anims/curtain = SubResource( 1 )
|
|
||||||
anims/fade_black = SubResource( 2 )
|
|
||||||
anims/fade_white = SubResource( 3 )
|
|
||||||
|
|||||||
@@ -92,6 +92,29 @@ func set_escoria_ui_settings():
|
|||||||
}
|
}
|
||||||
ProjectSettings.add_property_info(game_scene_property_info)
|
ProjectSettings.add_property_info(game_scene_property_info)
|
||||||
|
|
||||||
|
if !ProjectSettings.has_setting("escoria/ui/default_transition"):
|
||||||
|
ProjectSettings.set_setting(
|
||||||
|
"escoria/ui/default_transition",
|
||||||
|
"curtain"
|
||||||
|
)
|
||||||
|
ProjectSettings.add_property_info({
|
||||||
|
"name": "escoria/ui/default_transition",
|
||||||
|
"type": TYPE_STRING
|
||||||
|
})
|
||||||
|
|
||||||
|
if !ProjectSettings.has_setting("escoria/ui/transition_paths"):
|
||||||
|
ProjectSettings.set_setting(
|
||||||
|
"escoria/ui/transition_paths",
|
||||||
|
[
|
||||||
|
"res://addons/escoria-core/game/scenes/transitions/shaders/"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
ProjectSettings.add_property_info({
|
||||||
|
"name": "escoria/ui/transition_paths",
|
||||||
|
"type": TYPE_STRING_ARRAY,
|
||||||
|
"hint": PROPERTY_HINT_DIR
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
# Prepare the settings in the Escoria main category
|
# Prepare the settings in the Escoria main category
|
||||||
func set_escoria_main_settings():
|
func set_escoria_main_settings():
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ Return the sprite node
|
|||||||
### set\_angle
|
### set\_angle
|
||||||
|
|
||||||
```gdscript
|
```gdscript
|
||||||
func set_angle(deg: int, immediate = true)
|
func set_angle(deg: int, wait: float = 0)
|
||||||
```
|
```
|
||||||
|
|
||||||
Set the angle
|
Set the angle
|
||||||
@@ -357,13 +357,12 @@ Set the angle
|
|||||||
#### Parameters
|
#### Parameters
|
||||||
|
|
||||||
- deg: The angle degree to set
|
- deg: The angle degree to set
|
||||||
- immediate: Set the angle immediately. If false will show intermediate
|
- wait: Wait this amount of seconds until continuing with turning around
|
||||||
angles
|
|
||||||
|
|
||||||
### turn\_to
|
### turn\_to
|
||||||
|
|
||||||
```gdscript
|
```gdscript
|
||||||
func turn_to(object: Node, immediate = true)
|
func turn_to(object: Node, wait: float = 0)
|
||||||
```
|
```
|
||||||
|
|
||||||
Turn to face another object
|
Turn to face another object
|
||||||
@@ -371,8 +370,7 @@ Turn to face another object
|
|||||||
#### Parameters
|
#### Parameters
|
||||||
|
|
||||||
- deg: The angle degree to set
|
- deg: The angle degree to set
|
||||||
- immediate: Set the angle immediately. If false will show intermediate
|
- float Wait this amount of seconds until continuing with turning around
|
||||||
angles
|
|
||||||
|
|
||||||
### start\_talking
|
### start\_talking
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ Update the sprite scale and lighting
|
|||||||
### set\_angle
|
### set\_angle
|
||||||
|
|
||||||
```gdscript
|
```gdscript
|
||||||
func set_angle(deg: int, immediate = true) -> var
|
func set_angle(deg: int, wait: float = 0) -> var
|
||||||
```
|
```
|
||||||
|
|
||||||
Sets character's angle and plays according animation.
|
Sets character's angle and plays according animation.
|
||||||
@@ -178,14 +178,12 @@ Sets character's angle and plays according animation.
|
|||||||
#### Parameters
|
#### Parameters
|
||||||
|
|
||||||
- deg int angle to set the character
|
- deg int angle to set the character
|
||||||
- immediate
|
- wait float Wait this amount of seconds until continuing with turning around
|
||||||
If true, direction is switched immediately. Else, successive
|
|
||||||
animations are used so that the character turns to target angle.
|
|
||||||
|
|
||||||
### turn\_to
|
### turn\_to
|
||||||
|
|
||||||
```gdscript
|
```gdscript
|
||||||
func turn_to(item: Node, immediate = true) -> void
|
func turn_to(item: Node, wait: float = 0) -> void
|
||||||
```
|
```
|
||||||
|
|
||||||
Turns the character to face another item or character.
|
Turns the character to face another item or character.
|
||||||
@@ -193,9 +191,7 @@ Turns the character to face another item or character.
|
|||||||
#### Parameters
|
#### Parameters
|
||||||
|
|
||||||
- item_id id of the object to face.
|
- item_id id of the object to face.
|
||||||
- immediate
|
- float Wait this amount of seconds until continuing with turning around
|
||||||
If true, direction is switched immediately. Else, successive
|
|
||||||
animations are used so that the character turns to target angle.
|
|
||||||
|
|
||||||
### get\_shortest\_way\_to\_dir
|
### get\_shortest\_way\_to\_dir
|
||||||
|
|
||||||
|
|||||||
60
docs/api/ESCTransitionPlayer.md
Normal file
60
docs/api/ESCTransitionPlayer.md
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<!-- Auto-generated from JSON by GDScript docs maker. Do not edit this document directly. -->
|
||||||
|
|
||||||
|
# ESCTransitionPlayer
|
||||||
|
|
||||||
|
**Extends:** [ColorRect](../ColorRect)
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
A transition player for scene changes
|
||||||
|
|
||||||
|
## Enumerations
|
||||||
|
|
||||||
|
### TRANSITION\_MODE
|
||||||
|
|
||||||
|
```gdscript
|
||||||
|
const TRANSITION_MODE: Dictionary = {"IN":0,"OUT":1}
|
||||||
|
```
|
||||||
|
|
||||||
|
The valid transition modes
|
||||||
|
|
||||||
|
## Method Descriptions
|
||||||
|
|
||||||
|
### transition
|
||||||
|
|
||||||
|
```gdscript
|
||||||
|
func transition(transition_name: String = "", mode: int, duration: float = 1) -> void
|
||||||
|
```
|
||||||
|
|
||||||
|
### get\_transition
|
||||||
|
|
||||||
|
```gdscript
|
||||||
|
func get_transition(name: String) -> String
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns the full path for a transition shader based on its name
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
- name: The name of the transition to test
|
||||||
|
|
||||||
|
*Returns* the full path to the shader or an empty string, if it can't be found
|
||||||
|
|
||||||
|
### has\_transition
|
||||||
|
|
||||||
|
```gdscript
|
||||||
|
func has_transition(name: String) -> bool
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns true whether the transition scene has a transition corresponding
|
||||||
|
to name provided.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
- name: The name of the transition to test
|
||||||
|
|
||||||
|
*Returns* true if a transition exists with given name.
|
||||||
|
|
||||||
|
## Signals
|
||||||
|
|
||||||
|
- signal transition_done(): Emitted when the transition was played
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
`set_angle object degrees [immediate]`
|
`set_angle object degrees [wait]`
|
||||||
|
|
||||||
Turns object to a degrees angle without animations. 0 sets object facing
|
Turns object to a degrees angle without animations. 0 sets object facing
|
||||||
forward, 90 sets it 90 degrees clockwise ("east") etc. When turning to the
|
forward, 90 sets it 90 degrees clockwise ("east") etc. When turning to the
|
||||||
@@ -15,6 +15,9 @@ destination angle, animations are played if they're defined in animations.
|
|||||||
object must be player or interactive. degrees must be between [0, 360] or an
|
object must be player or interactive. degrees must be between [0, 360] or an
|
||||||
error is reported.
|
error is reported.
|
||||||
|
|
||||||
|
The wait parameter sets how long to wait for each intermediate angle. It
|
||||||
|
defaults to 0, meaning the turnaround is immediate.
|
||||||
|
|
||||||
@ESC
|
@ESC
|
||||||
|
|
||||||
## Method Descriptions
|
## Method Descriptions
|
||||||
|
|||||||
@@ -6,10 +6,16 @@
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
`transition transition_name in|out`
|
`transition transition_name in|out [delay]`
|
||||||
|
|
||||||
Performs a transition in our out manually.
|
Performs a transition in our out manually.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- transition_name: Name of the transition shader from one of the transition
|
||||||
|
directories
|
||||||
|
- in|out: Wether to play the transition in IN- or OUT-mode
|
||||||
|
- delay: Delay for the transition to take. Defaults to 1 second
|
||||||
|
|
||||||
@ESC
|
@ESC
|
||||||
|
|
||||||
## Method Descriptions
|
## Method Descriptions
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
`turn_to object object_to_face [immediate]`
|
`turn_to object object_to_face [wait]`
|
||||||
|
|
||||||
Turns object to face another object.
|
Turns object to face another object.
|
||||||
|
|
||||||
Set immediate to true to show directly switch to the direction and not
|
The wait parameter sets how long to wait for each intermediate angle. It
|
||||||
show intermediate angles
|
defaults to 0, meaning the turnaround is immediate.
|
||||||
|
|
||||||
@ESC
|
@ESC
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ The Escoria context currently in wait state
|
|||||||
### scene\_transition
|
### scene\_transition
|
||||||
|
|
||||||
```gdscript
|
```gdscript
|
||||||
var scene_transition
|
var scene_transition: ESCTransitionPlayer
|
||||||
```
|
```
|
||||||
|
|
||||||
Reference to the scene transition node
|
Reference to the scene transition node
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
<!-- Auto-generated from JSON by GDScript docs maker. Do not edit this document directly. -->
|
|
||||||
|
|
||||||
# transition.gd
|
|
||||||
|
|
||||||
**Extends:** [ColorRect](../ColorRect)
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
A transition player for scene changes
|
|
||||||
|
|
||||||
## Property Descriptions
|
|
||||||
|
|
||||||
### transition\_name
|
|
||||||
|
|
||||||
```gdscript
|
|
||||||
export var transition_name: String = ""
|
|
||||||
```
|
|
||||||
|
|
||||||
## Method Descriptions
|
|
||||||
|
|
||||||
### transition\_out
|
|
||||||
|
|
||||||
```gdscript
|
|
||||||
func transition_out(p_transition_name: String = "") -> var
|
|
||||||
```
|
|
||||||
|
|
||||||
Transition out
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
- p_transition_name: name of the transition to play (if empty string, uses
|
|
||||||
the default transition)
|
|
||||||
|
|
||||||
### transition\_in
|
|
||||||
|
|
||||||
```gdscript
|
|
||||||
func transition_in(p_transition_name: String = "") -> var
|
|
||||||
```
|
|
||||||
|
|
||||||
Transition in
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
- p_transition_name: name of the transition to play (if empty string, uses
|
|
||||||
the default transition)
|
|
||||||
|
|
||||||
### has\_transition
|
|
||||||
|
|
||||||
```gdscript
|
|
||||||
func has_transition(p_name: String) -> bool
|
|
||||||
```
|
|
||||||
|
|
||||||
Returns true whether the transition scene has a transition corresponding
|
|
||||||
to name provided.
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
- p_name: The name of the transition to test
|
|
||||||
|
|
||||||
*Returns* true if a transition exists with given name.
|
|
||||||
|
|
||||||
## Signals
|
|
||||||
|
|
||||||
- signal transition_done(): Emitted when the transition was played
|
|
||||||
19
docs/esc.md
19
docs/esc.md
@@ -277,7 +277,7 @@ event ends.
|
|||||||
|
|
||||||
Changes the "active" state of the object, value can be true or false.
|
Changes the "active" state of the object, value can be true or false.
|
||||||
Inactive objects are hidden in the scene.
|
Inactive objects are hidden in the scene.
|
||||||
#### <a name="SetAngleCommand.md"></a>`set_angle object degrees [immediate]` [API-Doc](api/SetAngleCommand.md)
|
#### <a name="SetAngleCommand.md"></a>`set_angle object degrees [wait]` [API-Doc](api/SetAngleCommand.md)
|
||||||
|
|
||||||
Turns object to a degrees angle without animations. 0 sets object facing
|
Turns object to a degrees angle without animations. 0 sets object facing
|
||||||
forward, 90 sets it 90 degrees clockwise ("east") etc. When turning to the
|
forward, 90 sets it 90 degrees clockwise ("east") etc. When turning to the
|
||||||
@@ -285,6 +285,9 @@ destination angle, animations are played if they're defined in animations.
|
|||||||
|
|
||||||
object must be player or interactive. degrees must be between [0, 360] or an
|
object must be player or interactive. degrees must be between [0, 360] or an
|
||||||
error is reported.
|
error is reported.
|
||||||
|
|
||||||
|
The wait parameter sets how long to wait for each intermediate angle. It
|
||||||
|
defaults to 0, meaning the turnaround is immediate.
|
||||||
#### <a name="SetAnimationsCommand.md"></a>`set_animations object animations` [API-Doc](api/SetAnimationsCommand.md)
|
#### <a name="SetAnimationsCommand.md"></a>`set_animations object animations` [API-Doc](api/SetAnimationsCommand.md)
|
||||||
|
|
||||||
Set the animation resource for the given ESCPlayer
|
Set the animation resource for the given ESCPlayer
|
||||||
@@ -348,15 +351,21 @@ Sets the position of object1 to the position of object2.
|
|||||||
#### <a name="TeleportPosCommand.md"></a>`teleport_pos object1 x y` [API-Doc](api/TeleportPosCommand.md)
|
#### <a name="TeleportPosCommand.md"></a>`teleport_pos object1 x y` [API-Doc](api/TeleportPosCommand.md)
|
||||||
|
|
||||||
Sets the position of object1 to the position (x,y).
|
Sets the position of object1 to the position (x,y).
|
||||||
#### <a name="TransitionCommand.md"></a>`transition transition_name in|out` [API-Doc](api/TransitionCommand.md)
|
#### <a name="TransitionCommand.md"></a>`transition transition_name in|out [delay]` [API-Doc](api/TransitionCommand.md)
|
||||||
|
|
||||||
Performs a transition in our out manually.
|
Performs a transition in our out manually.
|
||||||
#### <a name="TurnToCommand.md"></a>`turn_to object object_to_face [immediate]` [API-Doc](api/TurnToCommand.md)
|
|
||||||
|
Parameters:
|
||||||
|
- transition_name: Name of the transition shader from one of the transition
|
||||||
|
directories
|
||||||
|
- in|out: Wether to play the transition in IN- or OUT-mode
|
||||||
|
- delay: Delay for the transition to take. Defaults to 1 second
|
||||||
|
#### <a name="TurnToCommand.md"></a>`turn_to object object_to_face [wait]` [API-Doc](api/TurnToCommand.md)
|
||||||
|
|
||||||
Turns object to face another object.
|
Turns object to face another object.
|
||||||
|
|
||||||
Set immediate to true to show directly switch to the direction and not
|
The wait parameter sets how long to wait for each intermediate angle. It
|
||||||
show intermediate angles
|
defaults to 0, meaning the turnaround is immediate.
|
||||||
#### <a name="WaitCommand.md"></a>`wait seconds` [API-Doc](api/WaitCommand.md)
|
#### <a name="WaitCommand.md"></a>`wait seconds` [API-Doc](api/WaitCommand.md)
|
||||||
|
|
||||||
Blocks execution of the current script for a number of seconds specified by the "seconds" parameter.
|
Blocks execution of the current script for a number of seconds specified by the "seconds" parameter.
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ position = Vector2( 958.107, 176.401 )
|
|||||||
global_id = "r2_button_right"
|
global_id = "r2_button_right"
|
||||||
esc_script = "res://game/rooms/room02/esc/button.esc"
|
esc_script = "res://game/rooms/room02/esc/button.esc"
|
||||||
dialog_color = Color( 0, 1, 0.109804, 1 )
|
dialog_color = Color( 0, 1, 0.109804, 1 )
|
||||||
|
animations = null
|
||||||
|
|
||||||
[node name="Position2D" type="Position2D" parent="button_right"]
|
[node name="Position2D" type="Position2D" parent="button_right"]
|
||||||
position = Vector2( 29.4302, 195.411 )
|
position = Vector2( 29.4302, 195.411 )
|
||||||
@@ -104,6 +105,7 @@ position = Vector2( 288.82, 171.439 )
|
|||||||
global_id = "r2_button"
|
global_id = "r2_button"
|
||||||
esc_script = "res://game/rooms/room02/esc/button.esc"
|
esc_script = "res://game/rooms/room02/esc/button.esc"
|
||||||
dialog_color = Color( 0, 1, 0.109804, 1 )
|
dialog_color = Color( 0, 1, 0.109804, 1 )
|
||||||
|
animations = null
|
||||||
|
|
||||||
[node name="Position2D" type="Position2D" parent="button_left"]
|
[node name="Position2D" type="Position2D" parent="button_left"]
|
||||||
position = Vector2( 24.6681, 196.998 )
|
position = Vector2( 24.6681, 196.998 )
|
||||||
|
|||||||
31
game/rooms/room12/esc/button.esc
Normal file
31
game/rooms/room12/esc/button.esc
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
:use
|
||||||
|
|
||||||
|
say player "Default"
|
||||||
|
transition "" out
|
||||||
|
wait 1
|
||||||
|
transition "" in
|
||||||
|
|
||||||
|
say player "Fade white"
|
||||||
|
transition fade_white out
|
||||||
|
wait 1
|
||||||
|
transition fade_white in
|
||||||
|
|
||||||
|
say player "Fade black"
|
||||||
|
transition fade_black out
|
||||||
|
wait 1
|
||||||
|
transition fade_black in
|
||||||
|
|
||||||
|
say player "From Center"
|
||||||
|
transition from_center out
|
||||||
|
wait 1
|
||||||
|
transition from_center in
|
||||||
|
|
||||||
|
say player "Shards"
|
||||||
|
transition shards out
|
||||||
|
wait 1
|
||||||
|
transition shards in
|
||||||
|
|
||||||
|
say player "Blackout"
|
||||||
|
transition fade_black out 0.0
|
||||||
|
wait 1
|
||||||
|
transition fade_black in 0.0
|
||||||
@@ -17,7 +17,3 @@
|
|||||||
|
|
||||||
|
|
||||||
:ready
|
:ready
|
||||||
|
|
||||||
transition fade_white in
|
|
||||||
wait 2
|
|
||||||
transition fade_white out
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=10 format=2]
|
[gd_scene load_steps=11 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_terrain.gd" type="Script" id=1]
|
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_terrain.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://game/rooms/room12/background.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://game/rooms/room12/background.tscn" type="PackedScene" id=2]
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_room.gd" type="Script" id=6]
|
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_room.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=7]
|
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=7]
|
||||||
[ext_resource path="res://game/rooms/room12/r_door.tscn" type="PackedScene" id=8]
|
[ext_resource path="res://game/rooms/room12/r_door.tscn" type="PackedScene" id=8]
|
||||||
|
[ext_resource path="res://game/items/escitems/button.tscn" type="PackedScene" id=9]
|
||||||
|
|
||||||
[sub_resource type="NavigationPolygon" id=1]
|
[sub_resource type="NavigationPolygon" id=1]
|
||||||
vertices = PoolVector2Array( 1168.92, 640.557, 1182.53, 588.863, 1269.59, 622.872, 1275.03, 799.721, 864.626, 613.518, 1143.08, 613.35, -9.16094, 803.802, 386.666, 618.012, 129.634, 615.792, 84.5821, 654.06, -6.44019, 711.297, 3.15687, 646.051, 59.2201, 628.698 )
|
vertices = PoolVector2Array( 1168.92, 640.557, 1182.53, 588.863, 1269.59, 622.872, 1275.03, 799.721, 864.626, 613.518, 1143.08, 613.35, -9.16094, 803.802, 386.666, 618.012, 129.634, 615.792, 84.5821, 654.06, -6.44019, 711.297, 3.15687, 646.051, 59.2201, 628.698 )
|
||||||
@@ -75,6 +76,16 @@ esc_script = "res://game/rooms/room12/esc/right_exit.esc"
|
|||||||
position = Vector2( 1231.78, 360.624 )
|
position = Vector2( 1231.78, 360.624 )
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
|
|
||||||
|
[node name="button" parent="Hotspots" instance=ExtResource( 9 )]
|
||||||
|
pause_mode = 1
|
||||||
|
position = Vector2( 301.706, 73.0751 )
|
||||||
|
global_id = "r12_button"
|
||||||
|
esc_script = "res://game/rooms/room12/esc/button.esc"
|
||||||
|
animations = null
|
||||||
|
|
||||||
|
[node name="Position2D" type="Position2D" parent="Hotspots/button"]
|
||||||
|
position = Vector2( 340.052, 298.812 )
|
||||||
|
|
||||||
[node name="player_start" type="Position2D" parent="."]
|
[node name="player_start" type="Position2D" parent="."]
|
||||||
position = Vector2( 542.824, 468.193 )
|
position = Vector2( 542.824, 468.193 )
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
|
|||||||
@@ -324,6 +324,11 @@ _global_script_classes=[ {
|
|||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/core-scripts/esc_tooltip.gd"
|
"path": "res://addons/escoria-core/game/core-scripts/esc_tooltip.gd"
|
||||||
}, {
|
}, {
|
||||||
|
"base": "ColorRect",
|
||||||
|
"class": "ESCTransitionPlayer",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://addons/escoria-core/game/scenes/transitions/esc_transition_player.gd"
|
||||||
|
}, {
|
||||||
"base": "Object",
|
"base": "Object",
|
||||||
"class": "ESCUtils",
|
"class": "ESCUtils",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
@@ -563,6 +568,7 @@ _global_script_class_icons={
|
|||||||
"ESCStatement": "",
|
"ESCStatement": "",
|
||||||
"ESCTerrain": "res://addons/escoria-core/design/esc_terrain.svg",
|
"ESCTerrain": "res://addons/escoria-core/design/esc_terrain.svg",
|
||||||
"ESCTooltip": "",
|
"ESCTooltip": "",
|
||||||
|
"ESCTransitionPlayer": "",
|
||||||
"ESCUtils": "",
|
"ESCUtils": "",
|
||||||
"ESCWalkContext": "",
|
"ESCWalkContext": "",
|
||||||
"EnableTerrainCommand": "",
|
"EnableTerrainCommand": "",
|
||||||
@@ -666,6 +672,8 @@ ui/game_scene="res://addons/escoria-ui-simplemouse/game.tscn"
|
|||||||
ui/dialogs_chooser="res://game/ui/commons/dialogs/text_dialog_choice.tscn"
|
ui/dialogs_chooser="res://game/ui/commons/dialogs/text_dialog_choice.tscn"
|
||||||
sound/speech_folder="res://game/speech"
|
sound/speech_folder="res://game/speech"
|
||||||
sound/speech_extension="ogg"
|
sound/speech_extension="ogg"
|
||||||
|
ui/transition_paths=[ "res://addons/escoria-core/game/scenes/transitions/shaders/" ]
|
||||||
|
ui/default_transition="curtain"
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user