From 29a2b5e28d6842aa6ac35c368d589d18836047d8 Mon Sep 17 00:00:00 2001 From: Dennis Ploeger Date: Fri, 12 Nov 2021 14:34:09 +0100 Subject: [PATCH] feat: Optimized ESCCamera --- .../core-scripts/esc/commands/camera_push.gd | 2 +- .../core-scripts/esc/commands/camera_shift.gd | 15 +- .../game/core-scripts/esc_item.gd | 13 + .../game/core-scripts/esc_player.gd | 11 +- .../game/scenes/camera_player/esc_camera.gd | 290 +++++++++++------- game/characters/mark/mark.tscn | 170 +++++----- game/rooms/room07/room07.tscn | 10 - project.godot | 12 + 8 files changed, 299 insertions(+), 224 deletions(-) diff --git a/addons/escoria-core/game/core-scripts/esc/commands/camera_push.gd b/addons/escoria-core/game/core-scripts/esc/commands/camera_push.gd index 86a44334a..28598c9a3 100644 --- a/addons/escoria-core/game/core-scripts/esc/commands/camera_push.gd +++ b/addons/escoria-core/game/core-scripts/esc/commands/camera_push.gd @@ -39,6 +39,6 @@ func run(command_params: Array) -> int: .push( escoria.object_manager.get_object(command_params[0]).node, command_params[1], - command_params[2] + Tween.new().get("TRANS_%s" % command_params[2]) ) return ESCExecution.RC_OK diff --git a/addons/escoria-core/game/core-scripts/esc/commands/camera_shift.gd b/addons/escoria-core/game/core-scripts/esc/commands/camera_shift.gd index aadae3ef7..87fda1006 100644 --- a/addons/escoria-core/game/core-scripts/esc/commands/camera_shift.gd +++ b/addons/escoria-core/game/core-scripts/esc/commands/camera_shift.gd @@ -13,7 +13,12 @@ class_name CameraShiftCommand func configure() -> ESCCommandArgumentDescriptor: return ESCCommandArgumentDescriptor.new( 2, - [TYPE_INT, TYPE_INT, [TYPE_INT, TYPE_REAL], TYPE_STRING], + [ + [TYPE_INT, TYPE_REAL], + [TYPE_INT, TYPE_REAL], + [TYPE_INT, TYPE_REAL], + TYPE_STRING + ], [null, null, 1, "QUAD"] ) @@ -22,9 +27,11 @@ func configure() -> ESCCommandArgumentDescriptor: func run(command_params: Array) -> int: (escoria.object_manager.get_object("_camera").node as ESCCamera)\ .shift( - command_params[0], - command_params[1], + Vector2( + command_params[0], + command_params[1] + ), command_params[2], - command_params[3] + Tween.new().get("TRANS_%s" % command_params[3]) ) return ESCExecution.RC_OK diff --git a/addons/escoria-core/game/core-scripts/esc_item.gd b/addons/escoria-core/game/core-scripts/esc_item.gd index f0dee3605..2c6e9e72a 100644 --- a/addons/escoria-core/game/core-scripts/esc_item.gd +++ b/addons/escoria-core/game/core-scripts/esc_item.gd @@ -124,6 +124,10 @@ export(float) var v_speed_damp: float = 1.0 export(NodePath) var animation_player_node: NodePath = "" \ setget _set_animation_player_node +# The node that references the camera position and zoom if this item is used +# as a camera target +export(NodePath) var camera_node + # ESCAnimationsResource (for walking, idling...) var animations: ESCAnimationResource @@ -456,6 +460,15 @@ func stop_talking(): ) + +# Return the camera position if a camera_position_node exists or the +# global position of the player +func get_camera_node(): + if camera_node and get_node(camera_node): + return get_node(camera_node) + return self + + # Detect the child nodes and set respective references func _detect_children() -> void: # Initialize collision variable. diff --git a/addons/escoria-core/game/core-scripts/esc_player.gd b/addons/escoria-core/game/core-scripts/esc_player.gd index 6167c77c4..534697068 100644 --- a/addons/escoria-core/game/core-scripts/esc_player.gd +++ b/addons/escoria-core/game/core-scripts/esc_player.gd @@ -4,8 +4,7 @@ extends ESCItem class_name ESCPlayer, "res://addons/escoria-core/design/esc_player.svg" -# The node that references the camera position -export(NodePath) var camera_position_node + # Wether the player can be selected like an item export(bool) var selectable = false @@ -23,11 +22,3 @@ func _ready(): else: tooltip_name = "" disconnect("input_event", self, "manage_input") - - -# Return the camera position if a camera_position_node exists or the -# global position of the player -func get_camera_pos(): - if camera_position_node and get_node(camera_position_node): - return get_node(camera_position_node).global_position - return global_position diff --git a/addons/escoria-core/game/scenes/camera_player/esc_camera.gd b/addons/escoria-core/game/scenes/camera_player/esc_camera.gd index 15d356e96..1b7e77e55 100644 --- a/addons/escoria-core/game/scenes/camera_player/esc_camera.gd +++ b/addons/escoria-core/game/scenes/camera_player/esc_camera.gd @@ -4,23 +4,36 @@ class_name ESCCamera # Reference to the tween node for animating camera movements -var tween +var _tween: Tween # Target position of the camera -var target: Vector2 = Vector2() +var _target: Vector2 = Vector2() # The object to follow -var follow_target: Node = null +var _follow_target: Node = null # Target zoom of the camera -var zoom_target: Vector2 +var _zoom_target: Vector2 -# Time of zoom -var zoom_time + +# Prepare the tween +func _ready(): + _tween = Tween.new() + add_child(_tween) + _tween.connect("tween_all_completed", self, "_target_reached") + escoria.object_manager.register_object( + ESCObject.new( + "_camera", + self + ), + true + ) -# This is needed to adjust dialog positions and such, see dialog_instance.gd -var zoom_transform +# Update the position if the followed target is moving +func _process(_delta): + if is_instance_valid(_follow_target) and not _tween.is_active() and _follow_target.has_moved(): + self.global_position = _follow_target.global_position # Sets camera limits so it doesn't go out of the scene @@ -35,30 +48,34 @@ func set_limits(limits: ESCCameraLimits): self.limit_bottom = limits.limit_bottom +# Resolve the correct position and zoom of the target object +# +# #### Parameters +# - p_target: The target to resolve func _resolve_target_and_zoom(p_target) -> void: - target = Vector2() - zoom_target = Vector2() - follow_target = null + _target = Vector2() + _zoom_target = Vector2() + _follow_target = null + + if p_target is Node and "is_movable" in p_target and p_target.is_movable: + _follow_target = p_target + if p_target is Vector2: - target = p_target - elif p_target is Array: + _target = p_target + elif p_target is Array and p_target.size() > 0: var target_pos = Vector2() for obj in p_target: target_pos += obj.get_camera_pos() - # Let the error in if an empty array was passed (divzero) - target = target_pos / p_target.size() - elif p_target is Node and p_target.has_node("camera_pos") and \ - p_target.get_node("camera_pos") is Camera2D: - target = p_target.get_node("camera_pos").global_position - zoom_target = p_target.get_node("camera_pos").zoom - elif p_target is Node and "is_movable" in p_target and p_target.is_movable: - follow_target = p_target - elif p_target.has_method("get_camera_pos"): - target = p_target.get_camera_pos() + _target = target_pos / p_target.size() + elif p_target.has_method("get_camera_node"): + if "global_position" in p_target.get_camera_node(): + _target = p_target.get_camera_node().global_position + if "zoom" in p_target.get_camera_node(): + _zoom_target = p_target.get_camera_node().zoom else: - target = p_target.global_position + _target = p_target.global_position func set_drag_margin_enabled(p_dm_h_enabled, p_dm_v_enabled): @@ -66,147 +83,192 @@ func set_drag_margin_enabled(p_dm_h_enabled, p_dm_v_enabled): self.drag_margin_v_enabled = p_dm_v_enabled +# Set the target for the camera +# +# #### Parameters +# - p_target: Object to target +# - p_speed: Number of seconds for the camera to reach the target func set_target(p_target, p_speed : float = 0.0): var speed = p_speed _resolve_target_and_zoom(p_target) - if not follow_target == null: - target = follow_target.global_position - - escoria.logger.info("Current camera position = " + str(self.global_position)) + escoria.logger.info( + "Current camera position = %s " % str(self.global_position) + ) if speed == 0.0: - self.global_position = target + self.global_position = _target else: - var time = self.global_position.distance_to(target) / speed - - if tween.is_active(): - var tweenstat = String(tween.tell()) + "/" + String(tween.get_runtime()) - escoria.logger.report_warnings("camera.gd:set_target()", - ["Tween still active running camera_set_target: " + tweenstat]) - tween.emit_signal("tween_completed") + var time = self.global_position.distance_to(_target) / speed + + if _tween.is_active(): + escoria.logger.report_warnings( + "esc_camera.gd:set_target()", + [ + "Tween is still active: %f/%f" % [ + _tween.tell(), + _tween.get_runtime() + ] + ] + ) + _tween.emit_signal("tween_completed") - tween.interpolate_property( + _tween.interpolate_property( self, "global_position", self.global_position, - target, + _target, time, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT ) - tween.start() + _tween.start() -func set_camera_zoom(p_zoom_level, p_time): + +# Set the camera zoom level +# +# #### Parameters +# - p_zoom_level: Zoom level to set +# - p_time: Number of seconds for the camera to reach the zoom level +func set_camera_zoom(p_zoom_level: float, p_time: float): if p_zoom_level <= 0.0: - escoria.logger.report_errors("camera.gd:set_camera_zoom()", - ["Tried to set negative or zero zoom level"]) + escoria.logger.report_errors( + "camera.gd:set_camera_zoom()", + ["Tried to set negative or zero zoom level"] + ) - zoom_time = p_time - zoom_target = Vector2(1, 1) * p_zoom_level + _zoom_target = Vector2(1, 1) * p_zoom_level - if zoom_time == 0: - self.zoom = zoom_target + if p_time == 0: + self.zoom = _zoom_target else: - if tween.is_active(): - var tweenstat = String(tween.tell()) + "/" + String(tween.get_runtime()) - escoria.logger.report_warnings("camera", - ["Tween still active running camera_set_zoom: " + tweenstat]) - tween.emit_signal("tween_completed") - - tween.interpolate_property(self, "zoom", self.zoom, zoom_target, - zoom_time, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT) - tween.start() + if _tween.is_active(): + escoria.logger.report_warnings( + "esc_camera.gd:set_camera_zoom()", + [ + "Tween is still active: %f/%f" % [ + _tween.tell(), + _tween.get_runtime() + ] + ] + ) + _tween.emit_signal("tween_completed") + _tween.interpolate_property( + self, + "zoom", + self.zoom, + _zoom_target, + p_time, + Tween.TRANS_LINEAR, + Tween.EASE_IN_OUT + ) + _tween.start() -func push(p_target, p_time, p_type): - var time = float(p_time) - var type = "TRANS_" + p_type +# Push the camera towards the target in terms of position and zoom level +# using a given transition type and time. +# See +# https://docs.godotengine.org/en/stable/classes/class_tween.html#enumerations +# +# #### Parameters +# - p_target: Target to push to +# - p_time: Number of seconds for the transition to take +# - p_type: Tween transition type +func push(p_target, p_time: float = 0.0, p_type: int = 0): _resolve_target_and_zoom(p_target) var push_target = null - if follow_target != null: + if _follow_target != null: push_target = p_target.position else: - push_target = target + push_target = _target - if time == 0: + if p_time == 0: self.global_position = push_target - if zoom_target != Vector2(): - self.zoom = zoom_target + if _zoom_target != Vector2(): + self.zoom = _zoom_target else: - if tween.is_active(): - var tweenstat = String(tween.tell()) + "/" + String(tween.get_runtime()) - escoria.logger.report_warnings("camera", - ["Tween still active running camera_push: " + tweenstat]) - tween.emit_signal("tween_completed", null, null) - - if zoom_target != Vector2(): - tween.interpolate_property( + if _tween.is_active(): + escoria.logger.report_warnings( + "esc_camera.gd:push()", + [ + "Tween is still active:" % [ + _tween.tell(), + _tween.get_runtime() + ] + ] + ) + _tween.emit_signal("tween_completed", null, null) + + if _zoom_target != Vector2(): + _tween.interpolate_property( self, "zoom", self.zoom, - zoom_target, - time, - tween.get(type), + _zoom_target, + p_time, + p_type, Tween.EASE_IN_OUT ) - tween.interpolate_property( + _tween.interpolate_property( self, "global_position", self.global_position, push_target, - time, - tween.get(type), + p_time, + p_type, Tween.EASE_IN_OUT ) - tween.start() - + _tween.start() -func shift(p_x, p_y, p_time, p_type): - follow_target = null - var x = int(p_x) - var y = int(p_y) - var time = float(p_time) - var type = "TRANS_" + p_type - var new_pos = self.global_position + Vector2(x, y) - target = new_pos - - if tween.is_active(): - var tweenstat = String(tween.tell()) + "/" + String(tween.get_runtime()) - escoria.logger.report_warnings("camera", - ["Tween still active running camera_shift: " + tweenstat]) - tween.emit_signal("tween_completed") +# Shift the camera by the given vector in a given time and using a specific +# Tween transition type. +# +# See +# https://docs.godotengine.org/en/stable/classes/class_tween.html#enumerations +# +# #### Parameters +# - p_target: Vector to shift the camera by +# - p_time: Number of seconds for the transition to take +# - p_type: Tween transition type +func shift(p_target: Vector2, p_time: float, p_type: int): + _follow_target = null + + var new_pos = self.global_position + p_target + _target = new_pos + + if _tween.is_active(): + escoria.logger.report_warnings( + "esc_camera.gd:set_camera_zoom()", + [ + "Tween is still active: %f/%f" % [ + _tween.tell(), + _tween.get_runtime() + ] + ] + ) + _tween.emit_signal("tween_completed") - tween.interpolate_property(self, "global_position", self.global_position, - new_pos, float(time), tween.get(type), Tween.EASE_IN_OUT) - tween.start() + _tween.interpolate_property( + self, + "global_position", + self.global_position, + new_pos, + p_time, + p_type, + Tween.EASE_IN_OUT + ) + _tween.start() -func target_reached(): - tween.stop_all() +func _target_reached(): + _tween.stop_all() -func _process(_delta): - zoom_transform = self.get_canvas_transform() - if is_instance_valid(follow_target) and not tween.is_active() and follow_target.has_moved(): - self.global_position = follow_target.global_position - -func _ready(): - tween = Tween.new() - add_child(tween) - tween.connect("tween_all_completed", self, "target_reached") - escoria.object_manager.register_object( - ESCObject.new( - "_camera", - self - ), - true - ) diff --git a/game/characters/mark/mark.tscn b/game/characters/mark/mark.tscn index 6fabd47ce..c71c9f41e 100644 --- a/game/characters/mark/mark.tscn +++ b/game/characters/mark/mark.tscn @@ -9,191 +9,191 @@ [ext_resource path="res://game/characters/mark/png/mark_talk_right.png" type="Texture" id=7] [sub_resource type="AtlasTexture" id=1] -atlas = ExtResource( 4 ) -region = Rect2( 216, 0, 24, 70 ) +atlas = ExtResource( 5 ) +region = Rect2( 0, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=2] -atlas = ExtResource( 4 ) -region = Rect2( 240, 0, 24, 70 ) +atlas = ExtResource( 5 ) +region = Rect2( 24, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=3] -atlas = ExtResource( 4 ) -region = Rect2( 264, 0, 24, 70 ) +atlas = ExtResource( 5 ) +region = Rect2( 48, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=4] atlas = ExtResource( 4 ) -region = Rect2( 288, 0, 24, 70 ) +region = Rect2( 72, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=5] -atlas = ExtResource( 4 ) -region = Rect2( 312, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 0, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=6] -atlas = ExtResource( 4 ) -region = Rect2( 0, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 24, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=7] -atlas = ExtResource( 4 ) -region = Rect2( 336, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 48, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=8] -atlas = ExtResource( 4 ) -region = Rect2( 360, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 72, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=9] -atlas = ExtResource( 4 ) -region = Rect2( 384, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 96, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=10] -atlas = ExtResource( 4 ) -region = Rect2( 72, 0, 24, 70 ) +atlas = ExtResource( 6 ) +region = Rect2( 0, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=11] -atlas = ExtResource( 4 ) -region = Rect2( 96, 0, 24, 70 ) +atlas = ExtResource( 6 ) +region = Rect2( 24, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=12] atlas = ExtResource( 4 ) -region = Rect2( 24, 0, 24, 70 ) +region = Rect2( 120, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=13] -atlas = ExtResource( 5 ) -region = Rect2( 0, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 336, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=14] -atlas = ExtResource( 5 ) -region = Rect2( 24, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 360, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=15] -atlas = ExtResource( 5 ) -region = Rect2( 48, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 384, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=16] -atlas = ExtResource( 6 ) -region = Rect2( 0, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 144, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=17] -atlas = ExtResource( 6 ) -region = Rect2( 24, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 168, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=18] atlas = ExtResource( 4 ) -region = Rect2( 120, 0, 24, 70 ) +region = Rect2( 192, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=19] atlas = ExtResource( 4 ) -region = Rect2( 48, 0, 24, 70 ) +region = Rect2( 216, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=20] -atlas = ExtResource( 7 ) -region = Rect2( 0, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 240, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=21] -atlas = ExtResource( 7 ) -region = Rect2( 24, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 264, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=22] -atlas = ExtResource( 7 ) -region = Rect2( 48, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 288, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=23] -atlas = ExtResource( 7 ) -region = Rect2( 72, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 312, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=24] -atlas = ExtResource( 7 ) -region = Rect2( 96, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 48, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=25] atlas = ExtResource( 4 ) -region = Rect2( 144, 0, 24, 70 ) +region = Rect2( 24, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=26] -atlas = ExtResource( 4 ) -region = Rect2( 168, 0, 24, 70 ) +atlas = ExtResource( 2 ) +region = Rect2( 0, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=27] -atlas = ExtResource( 4 ) -region = Rect2( 192, 0, 24, 70 ) +atlas = ExtResource( 2 ) +region = Rect2( 24, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=28] atlas = ExtResource( 2 ) -region = Rect2( 0, 0, 24, 70 ) +region = Rect2( 48, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=29] -atlas = ExtResource( 2 ) -region = Rect2( 24, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 0, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=30] -atlas = ExtResource( 2 ) -region = Rect2( 48, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 96, 0, 24, 70 ) [sub_resource type="SpriteFrames" id=31] animations = [ { -"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ], +"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ) ], "loop": true, -"name": "walk_right", +"name": "speak_down_right", "speed": 6.0 }, { -"frames": [ SubResource( 6 ) ], +"frames": [ SubResource( 4 ) ], "loop": true, -"name": "idle_down", +"name": "idle_up", "speed": 5.0 }, { -"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 8 ) ], +"frames": [ SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ) ], "loop": true, -"name": "walk_up", -"speed": 6.0 -}, { -"frames": [ SubResource( 10 ) ], -"loop": true, -"name": "idle_up", +"name": "speak_right", "speed": 5.0 }, { -"frames": [ SubResource( 11 ) ], +"frames": [ SubResource( 10 ), SubResource( 11 ), SubResource( 10 ), SubResource( 11 ), SubResource( 11 ) ], "loop": true, -"name": "idle_left", -"speed": 5.0 +"name": "speak_up", +"speed": 3.0 }, { "frames": [ SubResource( 12 ) ], "loop": true, -"name": "idle_down_right", +"name": "idle_down_left", "speed": 5.0 }, { -"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 15 ) ], +"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 14 ) ], "loop": true, -"name": "speak_down_right", +"name": "walk_up", "speed": 6.0 }, { -"frames": [ SubResource( 16 ), SubResource( 17 ), SubResource( 16 ), SubResource( 17 ), SubResource( 17 ) ], +"frames": [ SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 17 ) ], "loop": true, -"name": "speak_up", -"speed": 3.0 +"name": "walk_down", +"speed": 6.0 }, { -"frames": [ SubResource( 18 ) ], +"frames": [ SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ) ], "loop": true, -"name": "idle_down_left", -"speed": 5.0 +"name": "walk_right", +"speed": 6.0 }, { -"frames": [ SubResource( 19 ) ], +"frames": [ SubResource( 24 ) ], "loop": true, "name": "idle_right", "speed": 5.0 }, { -"frames": [ SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ], +"frames": [ SubResource( 25 ) ], "loop": true, -"name": "speak_right", +"name": "idle_down_right", "speed": 5.0 }, { -"frames": [ SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 26 ) ], +"frames": [ SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 27 ), SubResource( 28 ) ], "loop": true, -"name": "walk_down", +"name": "speak_down", "speed": 6.0 }, { -"frames": [ SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 29 ), SubResource( 30 ) ], +"frames": [ SubResource( 29 ) ], "loop": true, -"name": "speak_down", -"speed": 6.0 +"name": "idle_down", +"speed": 5.0 +}, { +"frames": [ SubResource( 30 ) ], +"loop": true, +"name": "idle_left", +"speed": 5.0 } ] [sub_resource type="CapsuleShape2D" id=32] diff --git a/game/rooms/room07/room07.tscn b/game/rooms/room07/room07.tscn index a5da46e68..59de39cc1 100644 --- a/game/rooms/room07/room07.tscn +++ b/game/rooms/room07/room07.tscn @@ -252,11 +252,9 @@ position = Vector2( 27.5337, 131.767 ) script = ExtResource( 8 ) [node name="button_camera_push" parent="Hotspots" instance=ExtResource( 3 )] -pause_mode = 1 position = Vector2( -167.43, 1463.23 ) global_id = "r7_button_push" esc_script = "res://game/rooms/room07/esc/button_push.esc" -animations = null [node name="Position2D" type="Position2D" parent="Hotspots/button_camera_push"] position = Vector2( 343.048, 300.613 ) @@ -277,11 +275,9 @@ __meta__ = { } [node name="button_camera_shift" parent="Hotspots" instance=ExtResource( 3 )] -pause_mode = 1 position = Vector2( 9.393, 1464.03 ) global_id = "r7_button_shift" esc_script = "res://game/rooms/room07/esc/button_shift.esc" -animations = null [node name="Position2D" type="Position2D" parent="Hotspots/button_camera_shift"] position = Vector2( 350.258, 301.616 ) @@ -299,11 +295,9 @@ __meta__ = { } [node name="button_camera_follow" parent="Hotspots" instance=ExtResource( 3 )] -pause_mode = 1 position = Vector2( 172.527, 1464.03 ) global_id = "r7_button_follow" esc_script = "res://game/rooms/room07/esc/button_follow.esc" -animations = null [node name="Position2D" type="Position2D" parent="Hotspots/button_camera_follow"] position = Vector2( 350.258, 301.616 ) @@ -321,11 +315,9 @@ __meta__ = { } [node name="button_camera_zoom" parent="Hotspots" instance=ExtResource( 3 )] -pause_mode = 1 position = Vector2( 332.527, 1464.03 ) global_id = "r7_button_zoom" esc_script = "res://game/rooms/room07/esc/button_zoom.esc" -animations = null [node name="Position2D" type="Position2D" parent="Hotspots/button_camera_zoom"] position = Vector2( 350.258, 301.616 ) @@ -343,11 +335,9 @@ __meta__ = { } [node name="button_camera_set_pos" parent="Hotspots" instance=ExtResource( 3 )] -pause_mode = 1 position = Vector2( 910.482, 1464.03 ) global_id = "r7_button_set_pos" esc_script = "res://game/rooms/room07/esc/button_set_pos.esc" -animations = null [node name="Position2D" type="Position2D" parent="Hotspots/button_camera_set_pos"] position = Vector2( 350.258, 301.616 ) diff --git a/project.godot b/project.godot index 2e9730b87..9c3c677ff 100644 --- a/project.godot +++ b/project.godot @@ -365,6 +365,11 @@ _global_script_classes=[ { "path": "res://addons/escoria-core/game/core-scripts/esc/commands/enable_terrain.gd" }, { "base": "ESCBaseCommand", +"class": "HideMenuCommand", +"language": "GDScript", +"path": "res://addons/escoria-core/game/core-scripts/esc/commands/hide_menu.gd" +}, { +"base": "ESCBaseCommand", "class": "IncGlobalCommand", "language": "GDScript", "path": "res://addons/escoria-core/game/core-scripts/esc/commands/inc_global.gd" @@ -459,6 +464,11 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://addons/escoria-core/game/core-scripts/esc/commands/set_state.gd" }, { +"base": "ESCBaseCommand", +"class": "ShowMenuCommand", +"language": "GDScript", +"path": "res://addons/escoria-core/game/core-scripts/esc/commands/show_menu.gd" +}, { "base": "SlideCommand", "class": "SlideBlockCommand", "language": "GDScript", @@ -596,6 +606,7 @@ _global_script_class_icons={ "ESCUtils": "", "ESCWalkContext": "", "EnableTerrainCommand": "", +"HideMenuCommand": "", "IncGlobalCommand": "", "InventoryAddCommand": "", "InventoryRemoveCommand": "", @@ -615,6 +626,7 @@ _global_script_class_icons={ "SetSoundStateCommand": "", "SetSpeedCommand": "", "SetStateCommand": "", +"ShowMenuCommand": "", "SlideBlockCommand": "", "SlideCommand": "", "SpawnCommand": "",