diff --git a/addons/escoria-core/game/core-scripts/esc/commands/change_scene.gd b/addons/escoria-core/game/core-scripts/esc/commands/change_scene.gd index bc4e9293..74a78c11 100644 --- a/addons/escoria-core/game/core-scripts/esc/commands/change_scene.gd +++ b/addons/escoria-core/game/core-scripts/esc/commands/change_scene.gd @@ -57,6 +57,8 @@ func run(command_params: Array) -> int: escoria.main.scene_transition.fade_out() yield(escoria.main.scene_transition, "transition_done") + escoria.inputs_manager.clear_stack() + escoria.main_menu_instance.hide() var res_room = escoria.resource_cache.get_resource(command_params[0]) diff --git a/addons/escoria-core/game/core-scripts/esc_controller.gd b/addons/escoria-core/game/core-scripts/esc_controller.gd index 0b67782a..6649d44b 100644 --- a/addons/escoria-core/game/core-scripts/esc_controller.gd +++ b/addons/escoria-core/game/core-scripts/esc_controller.gd @@ -104,7 +104,8 @@ func perform_inputevent_on_object( global_position # If clicked object not in inventory, player walks towards it - if not escoria.inventory_manager.inventory_has(obj.global_id): + if not obj.node is ESCPlayer and \ + not escoria.inventory_manager.inventory_has(obj.global_id): var context = _walk_towards_object( obj, event.position, diff --git a/addons/escoria-core/game/core-scripts/esc_player.gd b/addons/escoria-core/game/core-scripts/esc_player.gd index 0b66e6ea..6167c77c 100644 --- a/addons/escoria-core/game/core-scripts/esc_player.gd +++ b/addons/escoria-core/game/core-scripts/esc_player.gd @@ -7,6 +7,9 @@ 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 + # A player is always movable func _init(): @@ -15,8 +18,11 @@ func _init(): # Ready function func _ready(): - # For ESCPlayer, avoid the CollisionShape2D used for movement to catch inputs - disconnect("input_event", self, "manage_input") + if selectable: + ._ready() + else: + tooltip_name = "" + disconnect("input_event", self, "manage_input") # Return the camera position if a camera_position_node exists or the diff --git a/addons/escoria-core/game/inputs_manager.gd b/addons/escoria-core/game/inputs_manager.gd index 43c78a2f..c30f8f90 100644 --- a/addons/escoria-core/game/inputs_manager.gd +++ b/addons/escoria-core/game/inputs_manager.gd @@ -92,6 +92,11 @@ func register_background(background: ESCBackground): "_on_mousewheel_action", [-1] ) + + +# Clear the stack of hovered items +func clear_stack(): + hover_stack = [] # The background was clicked with the LMB diff --git a/docs/api/ESCInputsManager.md b/docs/api/ESCInputsManager.md index 436205ed..4a2c40de 100644 --- a/docs/api/ESCInputsManager.md +++ b/docs/api/ESCInputsManager.md @@ -79,3 +79,10 @@ Connect the item signals to the local methods func register_background(background: ESCBackground) ``` +### clear\_stack + +```gdscript +func clear_stack() +``` + +Clear the stack of hovered items \ No newline at end of file diff --git a/docs/api/ESCPlayer.md b/docs/api/ESCPlayer.md index 4e3665eb..057f3c06 100644 --- a/docs/api/ESCPlayer.md +++ b/docs/api/ESCPlayer.md @@ -18,6 +18,14 @@ export var camera_position_node = "" The node that references the camera position +### selectable + +```gdscript +export var selectable = false +``` + +Wether the player can be selected like an item + ## Method Descriptions ### get\_camera\_pos diff --git a/game/characters/mark/mark.esc b/game/characters/mark/mark.esc new file mode 100644 index 00000000..5638a54a --- /dev/null +++ b/game/characters/mark/mark.esc @@ -0,0 +1,3 @@ +:look + +say player "That's a-me, Mark-io." diff --git a/game/characters/mark/mark.tscn b/game/characters/mark/mark.tscn index 013026f5..6fabd47c 100644 --- a/game/characters/mark/mark.tscn +++ b/game/characters/mark/mark.tscn @@ -9,202 +9,206 @@ [ext_resource path="res://game/characters/mark/png/mark_talk_right.png" type="Texture" id=7] [sub_resource type="AtlasTexture" id=1] -atlas = ExtResource( 2 ) -region = Rect2( 0, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=2] -atlas = ExtResource( 2 ) -region = Rect2( 24, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=3] -atlas = ExtResource( 2 ) -region = Rect2( 48, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=4] -atlas = ExtResource( 4 ) -region = Rect2( 48, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=5] -atlas = ExtResource( 7 ) -region = Rect2( 0, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=6] -atlas = ExtResource( 7 ) -region = Rect2( 24, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=7] -atlas = ExtResource( 7 ) -region = Rect2( 48, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=8] -atlas = ExtResource( 7 ) -region = Rect2( 72, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=9] -atlas = ExtResource( 7 ) -region = Rect2( 96, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=10] -atlas = ExtResource( 4 ) -region = Rect2( 144, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=11] -atlas = ExtResource( 4 ) -region = Rect2( 168, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=12] -atlas = ExtResource( 4 ) -region = Rect2( 192, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=13] atlas = ExtResource( 4 ) region = Rect2( 216, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=14] +[sub_resource type="AtlasTexture" id=2] atlas = ExtResource( 4 ) region = Rect2( 240, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=15] +[sub_resource type="AtlasTexture" id=3] atlas = ExtResource( 4 ) region = Rect2( 264, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=16] +[sub_resource type="AtlasTexture" id=4] atlas = ExtResource( 4 ) region = Rect2( 288, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=17] +[sub_resource type="AtlasTexture" id=5] atlas = ExtResource( 4 ) region = Rect2( 312, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=18] +[sub_resource type="AtlasTexture" id=6] atlas = ExtResource( 4 ) region = Rect2( 0, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=19] +[sub_resource type="AtlasTexture" id=7] atlas = ExtResource( 4 ) region = Rect2( 336, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=20] +[sub_resource type="AtlasTexture" id=8] atlas = ExtResource( 4 ) region = Rect2( 360, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=21] +[sub_resource type="AtlasTexture" id=9] atlas = ExtResource( 4 ) region = Rect2( 384, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=22] +[sub_resource type="AtlasTexture" id=10] atlas = ExtResource( 4 ) region = Rect2( 72, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=23] +[sub_resource type="AtlasTexture" id=11] atlas = ExtResource( 4 ) region = Rect2( 96, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=24] +[sub_resource type="AtlasTexture" id=12] atlas = ExtResource( 4 ) region = Rect2( 24, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=25] +[sub_resource type="AtlasTexture" id=13] atlas = ExtResource( 5 ) region = Rect2( 0, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=26] +[sub_resource type="AtlasTexture" id=14] atlas = ExtResource( 5 ) region = Rect2( 24, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=27] +[sub_resource type="AtlasTexture" id=15] atlas = ExtResource( 5 ) region = Rect2( 48, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=28] +[sub_resource type="AtlasTexture" id=16] atlas = ExtResource( 6 ) region = Rect2( 0, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=29] +[sub_resource type="AtlasTexture" id=17] atlas = ExtResource( 6 ) region = Rect2( 24, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=30] +[sub_resource type="AtlasTexture" id=18] atlas = ExtResource( 4 ) region = Rect2( 120, 0, 24, 70 ) +[sub_resource type="AtlasTexture" id=19] +atlas = ExtResource( 4 ) +region = Rect2( 48, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=20] +atlas = ExtResource( 7 ) +region = Rect2( 0, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=21] +atlas = ExtResource( 7 ) +region = Rect2( 24, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=22] +atlas = ExtResource( 7 ) +region = Rect2( 48, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=23] +atlas = ExtResource( 7 ) +region = Rect2( 72, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=24] +atlas = ExtResource( 7 ) +region = Rect2( 96, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=25] +atlas = ExtResource( 4 ) +region = Rect2( 144, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=26] +atlas = ExtResource( 4 ) +region = Rect2( 168, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=27] +atlas = ExtResource( 4 ) +region = Rect2( 192, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=28] +atlas = ExtResource( 2 ) +region = Rect2( 0, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=29] +atlas = ExtResource( 2 ) +region = Rect2( 24, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=30] +atlas = ExtResource( 2 ) +region = Rect2( 48, 0, 24, 70 ) + [sub_resource type="SpriteFrames" id=31] animations = [ { -"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 2 ), SubResource( 3 ) ], -"loop": true, -"name": "speak_down", -"speed": 6.0 -}, { -"frames": [ SubResource( 4 ) ], -"loop": true, -"name": "idle_right", -"speed": 5.0 -}, { -"frames": [ SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ) ], -"loop": true, -"name": "speak_right", -"speed": 5.0 -}, { -"frames": [ SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 11 ) ], -"loop": true, -"name": "walk_down", -"speed": 6.0 -}, { -"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ) ], +"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ], "loop": true, "name": "walk_right", "speed": 6.0 }, { -"frames": [ SubResource( 18 ) ], +"frames": [ SubResource( 6 ) ], "loop": true, "name": "idle_down", "speed": 5.0 }, { -"frames": [ SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 20 ) ], +"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 8 ) ], "loop": true, "name": "walk_up", "speed": 6.0 }, { -"frames": [ SubResource( 22 ) ], +"frames": [ SubResource( 10 ) ], "loop": true, "name": "idle_up", "speed": 5.0 }, { -"frames": [ SubResource( 23 ) ], +"frames": [ SubResource( 11 ) ], "loop": true, "name": "idle_left", "speed": 5.0 }, { -"frames": [ SubResource( 24 ) ], +"frames": [ SubResource( 12 ) ], "loop": true, "name": "idle_down_right", "speed": 5.0 }, { -"frames": [ SubResource( 25 ), SubResource( 26 ), SubResource( 27 ) ], +"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 15 ) ], "loop": true, "name": "speak_down_right", "speed": 6.0 }, { -"frames": [ SubResource( 28 ), SubResource( 29 ), SubResource( 28 ), SubResource( 29 ), SubResource( 29 ) ], +"frames": [ SubResource( 16 ), SubResource( 17 ), SubResource( 16 ), SubResource( 17 ), SubResource( 17 ) ], "loop": true, "name": "speak_up", "speed": 3.0 }, { -"frames": [ SubResource( 30 ) ], +"frames": [ SubResource( 18 ) ], "loop": true, "name": "idle_down_left", "speed": 5.0 +}, { +"frames": [ SubResource( 19 ) ], +"loop": true, +"name": "idle_right", +"speed": 5.0 +}, { +"frames": [ SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ], +"loop": true, +"name": "speak_right", +"speed": 5.0 +}, { +"frames": [ SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 26 ) ], +"loop": true, +"name": "walk_down", +"speed": 6.0 +}, { +"frames": [ SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 29 ), SubResource( 30 ) ], +"loop": true, +"name": "speak_down", +"speed": 6.0 } ] [sub_resource type="CapsuleShape2D" id=32] -height = 0.0 +radius = 38.2347 +height = 217.78 [node name="mark" type="Area2D"] pause_mode = 1 script = ExtResource( 1 ) global_id = "player" +esc_script = "res://game/characters/mark/mark.esc" is_movable = true +tooltip_name = "Me" dialog_color = Color( 1, 1, 1, 1 ) +selectable = true animations = ExtResource( 3 ) [node name="sprite" type="AnimatedSprite" parent="."] @@ -214,6 +218,7 @@ frames = SubResource( 31 ) animation = "idle_down" [node name="collision" type="CollisionShape2D" parent="."] +position = Vector2( 0.455139, -138.362 ) shape = SubResource( 32 ) [node name="debug" type="Label" parent="."]