Player with tooltips

This commit is contained in:
2023-02-24 19:28:52 +01:00
parent 8e72e44a4c
commit 825d38636a
12 changed files with 274 additions and 16 deletions

View File

@@ -0,0 +1,20 @@
tool
extends ESCItemWithTooltip
class_name ESCPlayerWithTooltip, "res://addons/escoria-core/design/esc_player.svg"
# Whether the player can be selected like an item
export(bool) var selectable = false
# A player is always movable
func _init():
is_movable = true
_force_registration = true
# Ready function
func _ready():
if selectable:
._ready()
else:
tooltip_name = ""

View File

@@ -227,9 +227,7 @@ func element_focused(element_id: String) -> void:
var target_obj = escoria.object_manager.get_object(element_id).node
if target_obj is ESCItem or ESCItemWithTooltip:
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
#$tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name)
if target_obj is ESCPlayer:
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
$tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name)
func element_unfocused() -> void:
$tooltip_layer/tooltip.set_target("")

View File

@@ -1,9 +1,8 @@
[gd_scene load_steps=11 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/inventory/inventory_ui.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd" type="Script" id=2]
[ext_resource path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" type="PackedScene" id=3]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/ESCTooltipWithIcon.tscn" type="PackedScene" id=4]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/game.gd" type="Script" id=5]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/tooltip/target_tooltip.tscn" type="PackedScene" id=6]
[ext_resource path="res://addons/escoria-core/ui_library/menus/main_menu/main_menu.tscn" type="PackedScene" id=7]
@@ -77,7 +76,7 @@ visible = false
[node name="tooltip_layer" type="CanvasLayer" parent="."]
layer = 2
[node name="tooltipOld" parent="tooltip_layer" instance=ExtResource( 6 )]
[node name="tooltip" parent="tooltip_layer" instance=ExtResource( 6 )]
mouse_filter = 2
bbcode_text = "[center][color=#000000][/color][/center]"
fit_content_height = true
@@ -89,6 +88,4 @@ bbcode_text = "[center][color=#000000][/color][/center]"
fit_content_height = true
offset_from_cursor = Vector2( -10, 50 )
[node name="tooltip" parent="tooltip_layer" instance=ExtResource( 4 )]
[connection signal="pressed" from="CanvasLayer/ui/HBoxContainer/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]

View File

@@ -0,0 +1,62 @@
[gd_scene load_steps=21 format=2]
[ext_resource path="res://gymkhana/characters/eneko/eneko_smoking_animatios.tres" type="Resource" id=1]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/esc_player_with_tooltip.gd" type="Script" id=2]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-011.png" type="Texture" id=3]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-005.png" type="Texture" id=4]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-002.png" type="Texture" id=5]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-003.png" type="Texture" id=6]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-001.png" type="Texture" id=7]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-010.png" type="Texture" id=8]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-016.png" type="Texture" id=9]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-009.png" type="Texture" id=10]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-008.png" type="Texture" id=11]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-012.png" type="Texture" id=12]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-013.png" type="Texture" id=13]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-004.png" type="Texture" id=14]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-006.png" type="Texture" id=15]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-007.png" type="Texture" id=16]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-015.png" type="Texture" id=17]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-014.png" type="Texture" id=18]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 7 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 14 ), ExtResource( 4 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 11 ), ExtResource( 10 ), ExtResource( 8 ), ExtResource( 3 ), ExtResource( 12 ), ExtResource( 13 ), ExtResource( 18 ), ExtResource( 17 ), ExtResource( 9 ) ],
"loop": true,
"name": "idle",
"speed": 5.0
}, {
"frames": [ ExtResource( 7 ) ],
"loop": true,
"name": "speak",
"speed": 5.0
} ]
[sub_resource type="CapsuleShape2D" id=2]
radius = 103.0
height = 238.0
[node name="ESCPlayerWithTooltip" type="Area2D"]
pause_mode = 1
script = ExtResource( 2 )
global_id = "eneko_smoking"
esc_script = "res://gymkhana/characters/eneko/eneko_smoking.esc"
is_movable = true
default_action = "action1"
combine_when_selected_action_is_in = [ ]
dialog_color = Color( 1, 1, 1, 1 )
animations = ExtResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
position = Vector2( 32.625, -50.56 )
scale = Vector2( 1.71167, 1.71167 )
frames = SubResource( 1 )
animation = "idle"
flip_h = true
[node name="dialog_position" type="Position2D" parent="."]
position = Vector2( -1, -223 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 26, -42 )
shape = SubResource( 2 )

View File

@@ -0,0 +1,62 @@
[gd_scene load_steps=21 format=2]
[ext_resource path="res://gymkhana/characters/eneko/eneko_smoking_animatios.tres" type="Resource" id=1]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/esc_player_with_tooltip.gd" type="Script" id=2]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-011.png" type="Texture" id=3]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-005.png" type="Texture" id=4]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-002.png" type="Texture" id=5]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-003.png" type="Texture" id=6]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-001.png" type="Texture" id=7]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-010.png" type="Texture" id=8]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-016.png" type="Texture" id=9]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-009.png" type="Texture" id=10]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-008.png" type="Texture" id=11]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-012.png" type="Texture" id=12]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-013.png" type="Texture" id=13]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-004.png" type="Texture" id=14]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-006.png" type="Texture" id=15]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-007.png" type="Texture" id=16]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-015.png" type="Texture" id=17]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-014.png" type="Texture" id=18]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 7 ), ExtResource( 5 ), ExtResource( 6 ), ExtResource( 14 ), ExtResource( 4 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 11 ), ExtResource( 10 ), ExtResource( 8 ), ExtResource( 3 ), ExtResource( 12 ), ExtResource( 13 ), ExtResource( 18 ), ExtResource( 17 ), ExtResource( 9 ) ],
"loop": true,
"name": "idle",
"speed": 5.0
}, {
"frames": [ ExtResource( 7 ) ],
"loop": true,
"name": "speak",
"speed": 5.0
} ]
[sub_resource type="CapsuleShape2D" id=2]
radius = 103.0
height = 238.0
[node name="ESCPlayerWithTooltip" type="Area2D"]
pause_mode = 1
script = ExtResource( 2 )
global_id = "eneko_smoking"
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/p_eneko_smoking.esc"
is_movable = true
default_action = "action1"
combine_when_selected_action_is_in = [ ]
dialog_color = Color( 1, 1, 1, 1 )
animations = ExtResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
position = Vector2( 32.625, -50.56 )
scale = Vector2( 1.71167, 1.71167 )
frames = SubResource( 1 )
animation = "idle"
flip_h = true
[node name="dialog_position" type="Position2D" parent="."]
position = Vector2( -1, -223 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 26, -42 )
shape = SubResource( 2 )

View File

@@ -0,0 +1,27 @@
[gd_resource type="Resource" load_steps=7 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/resources/esc_animationresource.gd" type="Script" id=1]
[ext_resource path="res://addons/escoria-core/game/core-scripts/resources/esc_directionangle.gd" type="Script" id=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/resources/esc_animationname.gd" type="Script" id=3]
[sub_resource type="Resource" id=1]
script = ExtResource( 2 )
angle_start = 0
angle_size = 360
[sub_resource type="Resource" id=2]
script = ExtResource( 3 )
animation = "idle"
mirrored = false
[sub_resource type="Resource" id=3]
script = ExtResource( 3 )
animation = "speak"
mirrored = false
[resource]
script = ExtResource( 1 )
dir_angles = [ SubResource( 1 ) ]
directions = [ SubResource( 2 ) ]
idles = [ SubResource( 2 ) ]
speaks = [ SubResource( 3 ) ]

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=29 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_player.gd" type="Script" id=1]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/esc_player_with_tooltip.gd" type="Script" id=1]
[ext_resource path="res://gymkhana/characters/oier/oier-mod.png" type="Texture" id=2]
[ext_resource path="res://gymkhana/characters/oier/oier_animations.tres" type="Resource" id=3]
@@ -176,7 +176,7 @@ animations = [ {
radius = 53.0
height = 208.0
[node name="ESCPlayer" type="Area2D"]
[node name="ESCPlayerWithTooltip" type="Area2D"]
pause_mode = 1
position = Vector2( -5, 0 )
script = ExtResource( 1 )

View File

@@ -0,0 +1,25 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd" type="Script" id=1]
[ext_resource path="res://gymkhana/items/inventory/assets/caja-herramientas.png" type="Texture" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 22.5, 12.5 )
[node name="ESCItemWithTooltip" type="Area2D"]
pause_mode = 1
script = ExtResource( 1 )
global_id = "I_caja_herramientas"
combine_when_selected_action_is_in = [ ]
inventory_texture = ExtResource( 2 )
dialog_color = Color( 1, 1, 1, 1 )
animations = null
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( -2, 0 )
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( -1.5, -0.5 )
shape = SubResource( 1 )

View File

@@ -0,0 +1,5 @@
:action1
say "Parece una caja de herramientas"
:action2
say "Mela quedo!!"

View File

@@ -0,0 +1,44 @@
:action1
say current_player "Tiene pinta de que fuma"
:action2
set_global loom_conversation_done false
#set_gui_visible false
#turn_to eneko_smoking player
?
- "What is your name?"
say current_player "Who are you?"
say eneko_smoking "I'm the worker" [!name_known]
say eneko_smoking "You already asked me that" [name_known]
set_global name_known true
- "Why are you here?"
say current_player "Why are you here?"
say eneko_smoking "I'm waiting for you to give me the"
say eneko_smoking "filled form from room 5."
# This starts an inner subset of questions
- "Can I ask you about Loom?" [!loom_conversation_done]
say current_player "What do you know about Loom?"
say eneko_smoking "What do you want to know about Loom?"
?
- "Could it be created in Escoria?" [!loom_conversation_done]
say player "Could Loom be created in Escoria?"
say eneko_smoking "Yes!"
- "Is it a fun game?" [!loom_conversation_done, !fun_game_asked]
say player "Is Loom a fun game?"
say eneko_smoking "Yes!"
set_global fun_game_asked true
- "I don't want to talk at all any more." [!loom_conversation_done]
#turn_to eneko_smoking worker_face_down
stop
# This will take you back to the outer set of questions
- "I know enough about Loom." [!loom_conversation_done]
set_global loom_conversation_done true
!
- "I'm done."
say player "Bye!"
#turn_to eneko_smoking player
stop
!
set_gui_visible true

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=34 format=2]
[gd_scene load_steps=33 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_room.gd" type="Script" id=1]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_background.gd" type="Script" id=2]
@@ -7,7 +7,6 @@
[ext_resource path="res://gymkhana/rooms/trasera_cocina/HoverStartAnimation.gd" type="Script" id=5]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/background trasera cocina-1500x577-noItems.jpg" type="Texture" id=6]
[ext_resource path="res://gymkhana/characters/oier/oier.tscn" type="PackedScene" id=7]
[ext_resource path="res://game/items/inventory/wrench.png" type="Texture" id=8]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-014.png" type="Texture" id=9]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-011.png" type="Texture" id=10]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-002.png" type="Texture" id=11]
@@ -29,7 +28,7 @@
[ext_resource path="res://gymkhana/items/inventory/I_Bombona.tscn" type="PackedScene" id=27]
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd" type="Script" id=28]
[ext_resource path="res://gymkhana/items/inventory/assets/bombona-inv.png" type="Texture" id=29]
[ext_resource path="res://gymkhana/characters/eneko/eneko-smoking.tscn" type="PackedScene" id=30]
[ext_resource path="res://gymkhana/characters/eneko/eneko_smoking.tscn" type="PackedScene" id=30]
[ext_resource path="res://gymkhana/items/inventory/I_caja_herramientas.tscn" type="PackedScene" id=31]
[sub_resource type="SpriteFrames" id=2]
@@ -66,6 +65,7 @@ script = ExtResource( 2 )
position = Vector2( 1154, 358 )
scale = Vector2( 0.867751, 0.867751 )
frames = SubResource( 2 )
frame = 11
playing = true
offset = Vector2( -0.09375, 20.0582 )
@@ -164,17 +164,29 @@ margin_right = 40.0
margin_bottom = 40.0
[node name="EnekoSmoking" parent="." instance=ExtResource( 30 )]
position = Vector2( 961, 382 )
is_movable = true
position = Vector2( 962, 375 )
tooltip_name = "Objervar sujeto"
dialog_color = Color( 0, 1, 0.462745, 1 )
action1_text = "Objervar sujeto"
action2_text = "Hablar"
tooltip2_name = "Hablar"
selectable = true
[node name="ESCLocation" type="Position2D" parent="EnekoSmoking"]
position = Vector2( -111, 102 )
position = Vector2( -124, 124 )
script = ExtResource( 3 )
global_id = "eneko_smoking"
[node name="ESCItemWithTooltip" parent="." instance=ExtResource( 31 )]
position = Vector2( 728, 424 )
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_caja_herramientas.esc"
tooltip_name = "¿Que es esto?"
tooltip2_name = "Coger"
[node name="ESCLocation" type="Position2D" parent="ESCItemWithTooltip"]
position = Vector2( -51, 69 )
script = ExtResource( 3 )
global_id = "caja_herramientas"
[connection signal="mouse_entered" from="TextureRect" to="Area2D/CollisionPolygon2D" method="_on_TextureRect_mouse_entered"]
[connection signal="mouse_entered" from="Area2D" to="Area2D/CollisionPolygon2D" method="_on_Area2D_mouse_entered"]

View File

@@ -369,6 +369,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://addons/escoria-core/game/core-scripts/esc_player.gd"
}, {
"base": "ESCItemWithTooltip",
"class": "ESCPlayerWithTooltip",
"language": "GDScript",
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island/esc_player_with_tooltip.gd"
}, {
"base": "Resource",
"class": "ESCProjectSettingsManager",
"language": "GDScript",
@@ -767,6 +772,7 @@ _global_script_class_icons={
"ESCObject": "",
"ESCObjectManager": "",
"ESCPlayer": "res://addons/escoria-core/design/esc_player.svg",
"ESCPlayerWithTooltip": "res://addons/escoria-core/design/esc_player.svg",
"ESCProjectSettingsManager": "",
"ESCResourceCache": "",
"ESCResourceDescriptor": "",