Fixed a bug where bottle in magical closet room 9 had wrong interaction position.

This commit is contained in:
Julian Murgia
2021-02-26 21:31:50 +01:00
parent f743d1089c
commit b8f668df0a
25 changed files with 298 additions and 350 deletions

View File

@@ -105,15 +105,20 @@ func teleport(target, angle : Object = null) -> void:
Teleports the item on target position.
target can be Vector2 or Object
"""
if typeof(target) == TYPE_VECTOR2:
escoria.logger.info("Object " + target + " teleported at position" +
str(target) + "with angle", [angle])
if typeof(target) == TYPE_VECTOR2 :
escoria.logger.info("Object " + parent.global_id + " teleported at position " +
str(target) + " with angle", [angle])
parent.position = target
elif target is Position2D:
escoria.logger.info("Object " + parent.global_id + " teleported at position " +
str(target.position) + " with angle", [angle])
parent.position = target.position
elif typeof(target) == TYPE_OBJECT:
if target.get("interact_positions") != null:
parent.position = target.interact_positions.default #.global_position
else:
parent.position = target.position
# if target.get("interact_positions") != null:
# parent.position = target.interact_positions.default #.global_position
# else:
# parent.position = target.position
parent.position = target.get_interact_position()
escoria.logger.info("Object " + target.name + " teleported at position "
+ str(parent.position) + " with angle ", str(angle))
else:
@@ -221,6 +226,8 @@ func update_terrain(on_event_finished_name = null):
return
if parent.get("is_exit"):
return
if parent.get("dont_apply_terrain_scaling"):
return
var pos = parent.position
parent.z_index = pos.y if pos.y <= VisualServer.CANVAS_ITEM_Z_MAX else VisualServer.CANVAS_ITEM_Z_MAX

View File

@@ -53,12 +53,13 @@ export(bool) var use_from_inventory_only = false
# Scene used in inventory for the object if it is picked up
export(PackedScene) var inventory_item_scene_file : PackedScene
# Color used for dialogs
export(Color) var dialog_color = ColorN("white")
# Detected interact position set by a Position2D node OUTSIDE OF THE SCENE.
# You have to add a child to the INSTANCED SCENE, IN THE ROOM SCENE.
export(Dictionary) var interact_positions : Dictionary = { "default": null}
#var interact_positions : Dictionary = { "default": null}
# Animation node (null if none was found)
var animation_sprite
@@ -72,6 +73,9 @@ var terrain : ESCTerrain
var terrain_is_scalenodes : bool
var check_maps = true
var collision
# If dont_apply_terrain_scaling is true, terrain scaling will not be applied and
# node will remain at the scale set in the scene.
export(bool) var dont_apply_terrain_scaling = false
export(int) var speed : int = 300
export(float) var v_speed_damp : float = 1.0
@@ -111,10 +115,13 @@ func _ready():
connect("mouse_entered", self, "_on_mouse_entered")
connect("mouse_exited", self, "_on_mouse_exited")
connect("input_event", self, "manage_input")
init_interact_position_with_node()
# Initialize collision variable.
for c in get_children():
if c is CollisionShape2D or c is CollisionPolygon2D:
collision = c
# Register and connect all elements to Escoria backoffice.
if !Engine.is_editor_hint():
escoria.register_object(self)
terrain = escoria.room_terrain
@@ -131,7 +138,8 @@ func _ready():
connect("body_entered", self, "element_entered")
connect("body_exited", self, "element_exited")
if !is_exit:
# Perform a first terrain scaling if we have to.
if !is_exit or dont_apply_terrain_scaling:
Movable.last_scale = scale
Movable.update_terrain()
@@ -144,28 +152,46 @@ func get_animation_player():
return animation_sprite
"""
Initialize the interact_position attribute by searching for a Position2D
node in children nodes.
If any is found, the first one is used as interaction position with this hotspot.
If none is found, we use the CollisionShape2D or CollisionPolygon2D child node's
position instead.
"""
func init_interact_position_with_node():
interact_positions.default = null
#"""
#Initialize the interact_position attribute by searching for a Position2D
#node in children nodes.
#If any is found, the first one is used as interaction position with this hotspot.
#If none is found, we use the CollisionShape2D or CollisionPolygon2D child node's
#position instead.
#"""
#func init_interact_position_with_node():
# interact_positions.default = null
# for c in get_children():
# if c is Position2D:
# # If the position2D node is part of the hotspot, it means it is not an interact position
# # but a dialog position for example. Interact position node must be set in the room scene.
# if c.get_owner() == self:
# continue
# var globalpos = c.global_position
# interact_positions.default = c.global_position
#
# if c is CollisionShape2D or c is CollisionPolygon2D:
# collision = c
# if interact_positions.default == null:
# interact_positions.default = c.global_position
func get_interact_position() -> Vector2:
var interact_position = null
for c in get_children():
if c is Position2D:
# If the position2D node is part of the hotspot, it means it is not an interact position
# but a dialog position for example. Interact position node must be set in the room scene.
if c.get_owner() == self:
continue
interact_positions.default = c.global_position
interact_position = c.global_position
if c is CollisionShape2D or c is CollisionPolygon2D:
collision = c
if interact_positions.default == null:
interact_positions.default = c.global_position
if interact_position == null:
interact_position = c.global_position
return interact_position
func manage_input(viewport : Viewport, event : InputEvent, shape_idx : int):
if event is InputEventMouseButton:

View File

@@ -94,7 +94,7 @@ func update_size():
var nb_visible_characters = visible_characters
var nb_visible_lines = get_visible_line_count()
printt("BEFORE", "text_height", content_height, "rtl_height", rect_size.y)
# printt("BEFORE", "text_height", content_height, "rtl_height", rect_size.y)
# if text is too long and is wrapped
# var nblines = float(get_content_height()) / float(ONE_LINE_HEIGHT)
@@ -127,7 +127,7 @@ func update_size():
anchor_right = 0.0
anchor_bottom = 0.0
anchor_left = 0.0
printt("AFTER", "text_height", get_content_height(), "rtl_height", rect_size.y)
# printt("AFTER", "text_height", get_content_height(), "rtl_height", rect_size.y)
func _offset(position):
@@ -151,3 +151,8 @@ func tooltip_distance_to_edge_left(position : Vector2):
func tooltip_distance_to_edge_right(position : Vector2):
return escoria.game_size.x - position.x
func clear():
set_target("")
set_target2("")

View File

@@ -8,8 +8,15 @@ func warning(string : String, args = []):
func info(string : String, args = []):
var argsstr = str(args) if !args.empty() else ""
print("(I)\t" + string + " \t" + argsstr)
var argsstr = []
if !args.empty():
for arg in args:
if arg is Array:
for p in arg:
argsstr.append(p.global_id)
else:
argsstr.append(str(arg))
print("(I)\t" + string + " \t" + str(argsstr))
func error(string : String, args = []):

View File

@@ -202,8 +202,13 @@ func ev_left_click_on_item(obj, event, default_action = false):
var clicked_object_has_interact_position = false
if esc_runner.get_interactive(obj.global_id):
if obj.interact_positions.default != null:
destination_position = obj.interact_positions.default#.global_position
# if obj.interact_positions.default != null:
# destination_position = obj.interact_positions.default#.global_position
# clicked_object_has_interact_position = true
# else:
# destination_position = obj.position
if obj.get_interact_position() != null:
destination_position = obj.get_interact_position()
clicked_object_has_interact_position = true
else:
destination_position = obj.position

View File

@@ -9,105 +9,105 @@
[ext_resource path="res://game/characters/mark/png/mark_talk_right.png" type="Texture" id=7]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 7 )
region = Rect2( 0, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 7 )
region = Rect2( 24, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 7 )
region = Rect2( 48, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 7 )
region = Rect2( 72, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 7 )
region = Rect2( 96, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 4 )
region = Rect2( 0, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 4 )
region = Rect2( 336, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 4 )
region = Rect2( 360, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 4 )
region = Rect2( 384, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 6 )
region = Rect2( 0, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=11]
atlas = ExtResource( 6 )
region = Rect2( 24, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=12]
atlas = ExtResource( 4 )
region = Rect2( 120, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=13]
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 4 )
region = Rect2( 72, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=14]
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 5 )
region = Rect2( 0, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=15]
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 5 )
region = Rect2( 24, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=16]
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 5 )
region = Rect2( 48, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=17]
[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 4 )
region = Rect2( 48, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=18]
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 4 )
region = Rect2( 24, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 2 )
region = Rect2( 0, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=19]
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 2 )
region = Rect2( 24, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=20]
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 2 )
region = Rect2( 48, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=21]
[sub_resource type="AtlasTexture" id=11]
atlas = ExtResource( 4 )
region = Rect2( 144, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=22]
[sub_resource type="AtlasTexture" id=12]
atlas = ExtResource( 4 )
region = Rect2( 168, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=23]
[sub_resource type="AtlasTexture" id=13]
atlas = ExtResource( 4 )
region = Rect2( 192, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=24]
[sub_resource type="AtlasTexture" id=14]
atlas = ExtResource( 4 )
region = Rect2( 96, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=25]
[sub_resource type="AtlasTexture" id=15]
atlas = ExtResource( 4 )
region = Rect2( 0, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=16]
atlas = ExtResource( 4 )
region = Rect2( 336, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=17]
atlas = ExtResource( 4 )
region = Rect2( 360, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=18]
atlas = ExtResource( 4 )
region = Rect2( 384, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=19]
atlas = ExtResource( 6 )
region = Rect2( 0, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=20]
atlas = ExtResource( 6 )
region = Rect2( 24, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=21]
atlas = ExtResource( 7 )
region = Rect2( 0, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=22]
atlas = ExtResource( 7 )
region = Rect2( 24, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=23]
atlas = ExtResource( 7 )
region = Rect2( 48, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=24]
atlas = ExtResource( 7 )
region = Rect2( 72, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=25]
atlas = ExtResource( 7 )
region = Rect2( 96, 0, 24, 70 )
[sub_resource type="AtlasTexture" id=26]
atlas = ExtResource( 4 )
region = Rect2( 216, 0, 24, 70 )
@@ -130,64 +130,64 @@ region = Rect2( 312, 0, 24, 70 )
[sub_resource type="SpriteFrames" id=31]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
"loop": true,
"name": "speak_right",
"speed": 5.0
}, {
"frames": [ SubResource( 6 ) ],
"loop": true,
"name": "idle_down",
"speed": 5.0
}, {
"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ) ],
"loop": true,
"name": "walk_up",
"speed": 6.0
}, {
"frames": [ SubResource( 10 ), SubResource( 11 ), SubResource( 10 ), SubResource( 11 ), SubResource( 11 ) ],
"loop": true,
"name": "speak_up",
"speed": 3.0
}, {
"frames": [ SubResource( 12 ) ],
"frames": [ SubResource( 1 ) ],
"loop": true,
"name": "idle_down_left",
"speed": 5.0
}, {
"frames": [ SubResource( 13 ) ],
"frames": [ SubResource( 2 ) ],
"loop": true,
"name": "idle_up",
"speed": 5.0
}, {
"frames": [ SubResource( 14 ), SubResource( 15 ), SubResource( 16 ) ],
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
"loop": true,
"name": "speak_down_right",
"speed": 6.0
}, {
"frames": [ SubResource( 17 ) ],
"frames": [ SubResource( 6 ) ],
"loop": true,
"name": "idle_right",
"speed": 5.0
}, {
"frames": [ SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 19 ), SubResource( 20 ) ],
"frames": [ SubResource( 7 ) ],
"loop": true,
"name": "idle_down_right",
"speed": 5.0
}, {
"frames": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 9 ), SubResource( 10 ) ],
"loop": true,
"name": "speak_down",
"speed": 6.0
}, {
"frames": [ SubResource( 21 ), SubResource( 22 ), SubResource( 23 ) ],
"frames": [ SubResource( 11 ), SubResource( 12 ), SubResource( 13 ) ],
"loop": true,
"name": "walk_down",
"speed": 6.0
}, {
"frames": [ SubResource( 24 ) ],
"frames": [ SubResource( 14 ) ],
"loop": true,
"name": "idle_left",
"speed": 5.0
}, {
"frames": [ SubResource( 25 ) ],
"frames": [ SubResource( 15 ) ],
"loop": true,
"name": "idle_down_right",
"name": "idle_down",
"speed": 5.0
}, {
"frames": [ SubResource( 16 ), SubResource( 17 ), SubResource( 18 ) ],
"loop": true,
"name": "walk_up",
"speed": 6.0
}, {
"frames": [ SubResource( 19 ), SubResource( 20 ), SubResource( 19 ), SubResource( 20 ), SubResource( 20 ) ],
"loop": true,
"name": "speak_up",
"speed": 3.0
}, {
"frames": [ SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 25 ) ],
"loop": true,
"name": "speak_right",
"speed": 5.0
}, {
"frames": [ SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ), SubResource( 30 ) ],

View File

@@ -4,5 +4,7 @@ stop
:pickup
inventory_add r9_bottle true
set_active r9_bottle false
set_active r9_bottle_left false
set_active r9_bottle_middle false
set_active r9_bottle_right false

View File

@@ -18,9 +18,6 @@ combine_if_action_used_among = PoolStringArray( "use" )
use_from_inventory_only = true
inventory_item_scene_file = ExtResource( 3 )
dialog_color = Color( 1, 1, 1, 1 )
interact_positions = {
"default": Vector2( 0, 0 )
}
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )

View File

@@ -17,9 +17,6 @@ combine_if_action_used_among = PoolStringArray( "use" )
use_from_inventory_only = true
inventory_item_scene_file = ExtResource( 3 )
dialog_color = Color( 1, 1, 1, 1 )
interact_positions = {
"default": Vector2( 0, 0 )
}
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )

View File

@@ -77,15 +77,6 @@ text = "ROOM 5"
[node name="walkable_area" type="Navigation2D" parent="."]
script = ExtResource( 1 )
scales = null
bitmaps_scale = Vector2( 1, 1 )
lightmap = null
player_speed_multiplier = 1.0
player_doubleclick_speed_multiplier = 1.5
lightmap_modulate = Color( 1, 1, 1, 1 )
debug_mode = 1
scale_min = 0.3
scale_max = 1.0
[node name="platform" type="NavigationPolygonInstance" parent="walkable_area"]
position = Vector2( 6.73163, -264.779 )
@@ -103,9 +94,6 @@ esc_script = "res://game/rooms/room5/esc/left_exit.esc"
is_exit = true
tooltip_name = "Left exit"
dialog_color = Color( 1, 1, 1, 1 )
interact_positions = {
"default": Vector2( 37.4521, 392.045 )
}
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/l_door"]
polygon = PoolVector2Array( 0.328762, 440.897, 1.85199, 119.926, 85.9517, 74.6212, 87.1409, 377.869 )
@@ -121,9 +109,6 @@ esc_script = "res://game/rooms/room5/esc/right_exit.esc"
is_exit = true
tooltip_name = "Right exit"
dialog_color = Color( 1, 1, 1, 1 )
interact_positions = {
"default": Vector2( 1224.47, 353.99 )
}
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/r_door"]
polygon = PoolVector2Array( 1177.94, 348.61, 1175.95, 45.3759, 1276.06, 92.0953, 1277.95, 399.407 )
@@ -137,9 +122,6 @@ global_id = "r5_wall_item"
esc_script = "res://game/rooms/room5/esc/wall_item.esc"
tooltip_name = "Item on the wall"
default_action = "look"
interact_positions = {
"default": Vector2( 622.513, 359.162 )
}
[node name="Position2D2" type="Position2D" parent="Hotspots/item_wall"]
position = Vector2( 620.135, 613.652 )
@@ -150,25 +132,16 @@ __meta__ = {
[node name="wrench" parent="Hotspots" instance=ExtResource( 8 )]
position = Vector2( 257.269, 435.892 )
interaction_direction = 2
interact_positions = {
"default": Vector2( 179.848, 435.892 )
}
[node name="Position2D" type="Position2D" parent="Hotspots/wrench"]
position = Vector2( -77.4207, 0 )
[node name="pen" parent="Hotspots" instance=ExtResource( 10 )]
position = Vector2( 909.908, 443.451 )
interact_positions = {
"default": Vector2( 909.908, 443.451 )
}
[node name="empty_sheet" parent="Hotspots" instance=ExtResource( 9 )]
position = Vector2( 1059.84, 440.932 )
dialog_color = Color( 1, 1, 1, 1 )
interact_positions = {
"default": Vector2( 1059.84, 440.932 )
}
[node name="player_start" type="Position2D" parent="."]
position = Vector2( 76.7617, 437.649 )

View File

@@ -46,6 +46,15 @@ width = 4.0
[node name="walkable_area" type="Navigation2D" parent="."]
script = ExtResource( 1 )
scales = null
bitmaps_scale = Vector2( 1, 1 )
lightmap = null
player_speed_multiplier = 1.0
player_doubleclick_speed_multiplier = 1.5
lightmap_modulate = Color( 1, 1, 1, 1 )
debug_mode = 1
scale_min = 0.3
scale_max = 1.0
[node name="platform" type="NavigationPolygonInstance" parent="walkable_area"]
position = Vector2( 6.73163, -264.779 )
@@ -57,9 +66,6 @@ __meta__ = {
[node name="Hotspots" type="Node2D" parent="."]
[node name="l_exit" parent="Hotspots" instance=ExtResource( 3 )]
interact_positions = {
"default": Vector2( 37.4521, 392.045 )
}
[node name="Position2D" type="Position2D" parent="Hotspots/l_exit"]
position = Vector2( 37.4521, 392.045 )
@@ -68,9 +74,6 @@ __meta__ = {
}
[node name="r_door" parent="Hotspots" instance=ExtResource( 5 )]
interact_positions = {
"default": Vector2( 1180.52, 395.193 )
}
[node name="Position2D" type="Position2D" parent="Hotspots/r_door"]
position = Vector2( 1180.52, 395.193 )
@@ -81,9 +84,6 @@ __meta__ = {
[node name="worker" parent="Hotspots" instance=ExtResource( 7 )]
position = Vector2( 480, 430 )
interaction_direction = 2
interact_positions = {
"default": Vector2( 322.472, 428.374 )
}
[node name="Position2D2" type="Position2D" parent="Hotspots/worker"]
position = Vector2( -157.528, -1.62589 )

View File

@@ -1,7 +1,6 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=1]
[ext_resource path="res://game/items/escitems/bottle_escitem.tscn" type="PackedScene" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 66.4415, 154.457 )
@@ -21,7 +20,7 @@ tracks/0/keys = {
"values": [ true ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("base/open_no_object:visible")
tracks/1/path = NodePath("base/open:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
@@ -33,7 +32,7 @@ tracks/1/keys = {
"values": [ false ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("base/open_object:visible")
tracks/2/path = NodePath(".:default_action")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
@@ -42,22 +41,11 @@ tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("bottle:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
"values": [ "use" ]
}
[sub_resource type="Animation" id=3]
resource_name = "open"
length = 0.5
tracks/0/type = "value"
tracks/0/path = NodePath("base/closed:visible")
@@ -72,7 +60,7 @@ tracks/0/keys = {
"values": [ false ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("base/open_no_object:visible")
tracks/1/path = NodePath("base/open:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
@@ -84,7 +72,7 @@ tracks/1/keys = {
"values": [ true ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("base/open_object:visible")
tracks/2/path = NodePath(".:default_action")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
@@ -93,78 +81,13 @@ tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("bottle:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=4]
length = 0.5
tracks/0/type = "value"
tracks/0/path = NodePath("base/closed:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("base/open_no_object:visible")
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": 1,
"values": [ false ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("base/open_object:visible")
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": 1,
"values": [ true ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("bottle:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
"values": [ "walk" ]
}
[node name="closet" type="Area2D"]
script = ExtResource( 1 )
default_action = "use"
dialog_color = Color( 1, 1, 1, 1 )
interact_positions = {
"default": Vector2( 64.2172, 153.408 )
}
[node name="base" type="Line2D" parent="."]
position = Vector2( 1.12247, 0 )
@@ -189,52 +112,25 @@ polygon = PoolVector2Array( 29.051, 47.3419, 29.9949, 71.8826, 105.033, 71.8826,
points = PoolVector2Array( 106.643, 175.739, 105.894, 144.275 )
default_color = Color( 0.478431, 0.478431, 0.478431, 1 )
[node name="open_no_object" type="Node2D" parent="base"]
[node name="open" type="Node2D" parent="base"]
visible = false
[node name="black" type="Polygon2D" parent="base/open_no_object"]
[node name="black" type="Polygon2D" parent="base/open"]
color = Color( 0.141176, 0.141176, 0.141176, 1 )
polygon = PoolVector2Array( 5.79657, 8.23298, 5.79657, 297.059, 121.893, 299.89, 123.781, 6.34522 )
[node name="shelf" type="Line2D" parent="base/open_no_object"]
[node name="shelf" type="Line2D" parent="base/open"]
points = PoolVector2Array( 10.112, 86.2807, 118.234, 86.2807 )
default_color = Color( 0.4, 0.501961, 1, 1 )
[node name="door" type="Polygon2D" parent="base/open_no_object"]
[node name="door" type="Polygon2D" parent="base/open"]
color = Color( 0.4, 0.501961, 1, 1 )
polygon = PoolVector2Array( 1.07718, 7.2891, -37.6216, 23.335, -37.6216, 328.206, 2.02106, 302.722 )
[node name="open_object" type="Node2D" parent="base"]
visible = false
[node name="black" type="Polygon2D" parent="base/open_object"]
color = Color( 0.141176, 0.141176, 0.141176, 1 )
polygon = PoolVector2Array( 5.79657, 8.23298, 5.79657, 297.059, 121.893, 299.89, 123.781, 6.34522 )
[node name="shelf" type="Line2D" parent="base/open_object"]
points = PoolVector2Array( 10.112, 86.2807, 118.234, 86.2807 )
default_color = Color( 0.4, 0.501961, 1, 1 )
[node name="door" type="Polygon2D" parent="base/open_object"]
color = Color( 0.4, 0.501961, 1, 1 )
polygon = PoolVector2Array( 1.07718, 7.2891, -37.6216, 23.335, -37.6216, 328.206, 2.02106, 302.722 )
[node name="bottle" parent="." instance=ExtResource( 2 )]
visible = false
position = Vector2( 51.1535, 45.7845 )
scale = Vector2( 0.507, 0.507 )
interact_positions = {
"default": Vector2( 45.4966, 321.556 )
}
[node name="Position2D" type="Position2D" parent="bottle"]
position = Vector2( -11.1576, 543.928 )
[node name="CollisionPolygon2D" type="CollisionShape2D" parent="."]
position = Vector2( 64.2172, 153.408 )
shape = SubResource( 1 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/closed = SubResource( 2 )
anims/open_no_object = SubResource( 3 )
anims/open_object = SubResource( 4 )
anims/open = SubResource( 3 )

View File

@@ -8,11 +8,12 @@ set_global left_closet_open true
inc_global open_closets 1
> [lt open_closets 3]
set_state r9_closet_left open_no_object
set_state r9_closet_left open
stop
> [eq open_closets 3]
set_state r9_closet_left open_object
set_state r9_closet_left open
set_active r9_bottle_left true
stop
@@ -24,9 +25,10 @@ set_global left_closet_open true
inc_global open_closets 1
> [lt open_closets 3]
set_state r9_closet_left open_no_object
set_state r9_closet_left open
stop
> [eq open_closets 3]
set_state r9_closet_left open_object
set_state r9_closet_left open
set_active r9_bottle_left true
stop

View File

@@ -8,11 +8,12 @@ set_global middle_closet_open true
inc_global open_closets 1
> [lt open_closets 3]
set_state r9_closet_middle open_no_object
set_state r9_closet_middle open
stop
> [eq open_closets 3]
set_state r9_closet_middle open_object
set_state r9_closet_middle open
set_active r9_bottle_middle true
stop
@@ -24,9 +25,10 @@ set_global middle_closet_open true
inc_global open_closets 1
> [lt open_closets 3]
set_state r9_closet_middle open_no_object
set_state r9_closet_middle open
stop
> [eq open_closets 3]
set_state r9_closet_middle open_object
set_state r9_closet_middle open
set_active r9_bottle_middle true
stop

View File

@@ -8,11 +8,12 @@ set_global right_closet_open true
inc_global open_closets 1
> [lt open_closets 3]
set_state r9_closet_right open_no_object
set_state r9_closet_right open
stop
> [eq open_closets 3]
set_state r9_closet_right open_object
set_state r9_closet_right open
set_active r9_bottle_right true
stop
@@ -24,9 +25,10 @@ set_global right_closet_open true
inc_global open_closets 1
> [lt open_closets 3]
set_state r9_closet_right open_no_object
set_state r9_closet_right open
stop
> [eq open_closets 3]
set_state r9_closet_right open_object
set_state r9_closet_right open
set_active r9_bottle_right true
stop

View File

@@ -1,4 +1,4 @@
:use r9_bottle
set_state r9_stand set_bottle
set_state r9_right_exit open
set_state r9_door r_door_open

View File

@@ -112,9 +112,6 @@ esc_script = "res://game/rooms/room9/esc/r9_door.esc"
tooltip_name = "Door"
default_action = "look"
dialog_color = Color( 1, 1, 1, 1 )
interact_positions = {
"default": Vector2( 0, 0 )
}
[node name="r_door_closed" type="Polygon2D" parent="."]
color = Color( 0.482353, 0.568627, 1, 1 )

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=2]
[gd_scene load_steps=14 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/escterrain.gd" type="Script" id=1]
[ext_resource path="res://game/rooms/room9/background.tscn" type="PackedScene" id=2]
@@ -10,6 +10,7 @@
[ext_resource path="res://game/rooms/room2/button/button.tscn" type="PackedScene" id=8]
[ext_resource path="res://game/rooms/room9/r_door.tscn" type="PackedScene" id=9]
[ext_resource path="res://game/items/textures/genericItem_color_127.png" type="Texture" id=10]
[ext_resource path="res://game/items/escitems/bottle_escitem.tscn" type="PackedScene" id=11]
[sub_resource type="NavigationPolygon" id=1]
vertices = PoolVector2Array( 1168.92, 640.557, 1182.53, 588.863, 1269.59, 622.872, 1275.03, 799.721, 1143.08, 613.35, -9.16094, 803.802, -6.44019, 711.297, 846.646, 637.49, 3.15687, 646.051, 59.2201, 628.698, 84.5821, 654.06, 864.626, 613.518, 428.618, 640.487, 386.666, 618.012, 129.634, 615.792 )
@@ -54,15 +55,6 @@ __meta__ = {
[node name="walkable_area" type="Navigation2D" parent="."]
script = ExtResource( 1 )
scales = null
bitmaps_scale = Vector2( 1, 1 )
lightmap = null
player_speed_multiplier = 1.0
player_doubleclick_speed_multiplier = 1.5
lightmap_modulate = Color( 1, 1, 1, 1 )
debug_mode = 1
scale_min = 0.3
scale_max = 1.0
[node name="platform" type="NavigationPolygonInstance" parent="walkable_area"]
position = Vector2( 6.73163, -264.779 )
@@ -81,9 +73,6 @@ is_exit = true
tooltip_name = "Left exit"
default_action = "walk"
dialog_color = Color( 1, 1, 1, 1 )
interact_positions = {
"default": Vector2( 37.4521, 392.045 )
}
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/l_door"]
polygon = PoolVector2Array( 0.328762, 440.897, 1.85199, 119.926, 85.9517, 74.6212, 87.1409, 377.869 )
@@ -93,9 +82,6 @@ position = Vector2( 37.4521, 392.045 )
[node name="r_door" parent="Hotspots" instance=ExtResource( 9 )]
esc_script = "res://game/rooms/room9/esc/right_exit.esc"
interact_positions = {
"default": Vector2( 1198.65, 391.058 )
}
[node name="Position2D" type="Position2D" parent="Hotspots/r_door"]
position = Vector2( 1198.65, 391.058 )
@@ -105,47 +91,62 @@ position = Vector2( 435.233, 64.1518 )
global_id = "r9_closet_left"
esc_script = "res://game/rooms/room9/esc/closet_left.esc"
tooltip_name = "Left closet"
default_action = "use"
interact_positions = {
"default": Vector2( 505.158, 383.05 )
}
[node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_left"]
position = Vector2( 69.9246, 318.898 )
[node name="bottle_left" parent="Hotspots/r9_closet_left" instance=ExtResource( 11 )]
visible = false
position = Vector2( 46.4878, 47.8335 )
scale = Vector2( 0.5, 0.5 )
global_id = "r9_bottle_left"
dont_apply_terrain_scaling = true
[node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_left/bottle_left"]
position = Vector2( -26.727, 543.448 )
[node name="r9_closet_middle" parent="Hotspots" instance=ExtResource( 5 )]
position = Vector2( 572.963, 65.2113 )
global_id = "r9_closet_middle"
esc_script = "res://game/rooms/room9/esc/closet_middle.esc"
tooltip_name = "Middle closet"
default_action = "use"
interact_positions = {
"default": Vector2( 638.65, 383.05 )
}
[node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_middle"]
position = Vector2( 65.6867, 317.839 )
[node name="bottle_middle" parent="Hotspots/r9_closet_middle" instance=ExtResource( 11 )]
visible = false
position = Vector2( 45.9562, 46.774 )
scale = Vector2( 0.5, 0.5 )
global_id = "r9_bottle_middle"
dont_apply_terrain_scaling = true
[node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_middle/bottle_middle"]
position = Vector2( -26.727, 543.448 )
[node name="r9_closet_right" parent="Hotspots" instance=ExtResource( 5 )]
position = Vector2( 710.693, 66.2707 )
global_id = "r9_closet_right"
esc_script = "res://game/rooms/room9/esc/closet_right.esc"
tooltip_name = "Right closet"
default_action = "use"
interact_positions = {
"default": Vector2( 775.32, 383.05 )
}
[node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_right"]
position = Vector2( 64.6273, 316.779 )
[node name="bottle_right" parent="Hotspots/r9_closet_right" instance=ExtResource( 11 )]
visible = false
position = Vector2( 47.2065, 45.7146 )
scale = Vector2( 0.5, 0.5 )
global_id = "r9_bottle_right"
dont_apply_terrain_scaling = true
[node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_right/bottle_right"]
position = Vector2( -26.727, 543.448 )
[node name="button" parent="Hotspots" instance=ExtResource( 8 )]
position = Vector2( 240.688, 160.459 )
global_id = "r9_button_reset"
esc_script = "res://game/rooms/room9/esc/button_reset.esc"
interact_positions = {
"default": Vector2( 270.892, 369.999 )
}
[node name="Position2D" type="Position2D" parent="Hotspots/button"]
position = Vector2( 30.204, 209.54 )
@@ -166,13 +167,10 @@ position = Vector2( -125.617, 0.8909 )
script = ExtResource( 7 )
global_id = "r9_stand"
esc_script = "res://game/rooms/room9/esc/stand.esc"
interaction_direction = 2
tooltip_name = "Stand"
default_action = "look"
use_from_inventory_only = true
dialog_color = Color( 1, 1, 1, 1 )
interact_positions = {
"default": Vector2( -125.617, 0.8909 )
}
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/stand"]
polygon = PoolVector2Array( 1086.57, 357.819, 1087.46, 226.857, 1134.68, 228.639, 1133.79, 358.71 )
@@ -190,7 +188,7 @@ texture = ExtResource( 10 )
anims/set_bottle = SubResource( 2 )
[node name="Position2D" type="Position2D" parent="Hotspots/stand"]
position = Vector2( 1111.74, 380.57 )
position = Vector2( 1043.27, 359.243 )
[node name="player_start" type="Position2D" parent="."]
position = Vector2( 76.7617, 437.649 )

View File

@@ -31,6 +31,8 @@ Implement methods to react to inputs.
- _on_event_done(event_name: String)
"""
func _ready():
ProjectSettings.set_setting("escoria/ui/tooltip_follows_mouse", false)
func _input(event):
if event.is_action_pressed("switch_action_verb"):
@@ -61,11 +63,16 @@ func left_double_click_on_bg(position : Vector2) -> void:
## ITEM FOCUS ##
func element_focused(element_id : String) -> void:
$ui/tooltip_layer/tooltip.set_target(escoria.esc_runner.get_object(element_id).tooltip_name)
var target_obj = escoria.esc_runner.get_object(element_id)
$ui/tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
if escoria.esc_runner.current_action != "use" && escoria.esc_runner.current_tool == null:
if target_obj is ESCItem:
$ui/verbs_layer/verbs_menu.set_by_name(target_obj.default_action)
func element_unfocused() -> void:
$ui/tooltip_layer/tooltip.set_target("")
$ui/tooltip_layer/tooltip.clear()
$ui/verbs_layer/verbs_menu.unselect_actions()
## ITEMS ##
@@ -73,6 +80,7 @@ func left_click_on_item(item_global_id : String, event : InputEvent) -> void:
escoria.do("item_left_click", [item_global_id, event])
func right_click_on_item(item_global_id : String, event : InputEvent) -> void:
escoria.esc_runner.set_current_action($ui/verbs_layer/verbs_menu.selected_action)
escoria.do("item_right_click", [item_global_id, event])
func left_double_click_on_item(item_global_id : String, event : InputEvent) -> void:

View File

@@ -63,7 +63,9 @@ margin_left = 0.0272522
margin_top = 0.320557
margin_right = -0.252686
margin_bottom = -0.0794678
rect_min_size = Vector2( 0, 32 )
script = ExtResource( 8 )
color = Color( 1, 1, 1, 1 )
[node name="dialog_layer" type="CanvasLayer" parent="ui"]
layer = 3

View File

@@ -1,17 +1,31 @@
extends ESCTooltip
func update_tooltip_text():
push_align(RichTextLabel.ALIGN_CENTER)
bbcode_text = "[center]"
bbcode_text += "[color=#" + color.to_html(false) + "]"
if !current_action.empty():
add_text(current_action + "\t")
add_text(current_target)
bbcode_text += current_action + "\t"
bbcode_text += current_target
if waiting_for_target2 and current_target2.empty():
add_text("\t" + current_prep)
bbcode_text += "\t" + current_prep
if !current_target2.empty():
add_text("\t" + current_prep + "\t" + current_target2)
pop()
bbcode_text += "\t" + current_prep + "\t" + current_target2
bbcode_text += "[/color]"
bbcode_text += "[/center]"
# push_align(RichTextLabel.ALIGN_CENTER)
# if !current_action.empty():
# add_text(current_action + "\t")
#
# add_text(current_target)
#
# if waiting_for_target2 and current_target2.empty():
# add_text("\t" + current_prep)
#
# if !current_target2.empty():
# add_text("\t" + current_prep + "\t" + current_target2)
#
# pop()

View File

@@ -6,6 +6,8 @@ This script is out of Escoria's scope. It controls the UI reaction to an
UI event (eg right click) to change the cursor accordingly.
"""
var selected_action
func _ready():
for but in $actions.get_children():
but.connect("pressed", self, "_on_action_selected", [but.name])
@@ -20,3 +22,10 @@ func _on_action_selected(action : String):
func unselect_actions():
for but in $actions.get_children():
but.set_pressed(false)
func set_by_name(action_name : String):
selected_action = action_name
for but in $actions.get_children():
but.set_pressed(but.get_name() == action_name)

View File

@@ -29,9 +29,12 @@ Implement methods to react to inputs.
- show_ui()
- _on_event_done(event_name: String)
"""
func _ready():
ProjectSettings.set_setting("escoria/ui/tooltip_follows_mouse", true)
## BACKGROUND ##
func left_click_on_bg(position : Vector2) -> void:
@@ -54,7 +57,6 @@ func left_double_click_on_bg(position : Vector2) -> void:
func element_focused(element_id : String) -> void:
var target_obj = escoria.esc_runner.get_object(element_id)
$ui/tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
$ui/tooltip_layer/tooltip.show()
if escoria.esc_runner.current_action != "use" && escoria.esc_runner.current_tool == null:
if target_obj is ESCItem:
@@ -62,7 +64,6 @@ func element_focused(element_id : String) -> void:
func element_unfocused() -> void:
$ui/tooltip_layer/tooltip.set_target("")
$ui/tooltip_layer/tooltip.hide()
## ITEMS ##

View File

@@ -1,7 +1,6 @@
extends ESCTooltip
func update_tooltip_text():
print("new color " + str(color))
bbcode_text = "[center]"
bbcode_text += "[color=#" + color.to_html(false) + "]"
bbcode_text += current_target

View File

@@ -125,11 +125,10 @@ main/force_quit=true
debug/terminate_on_warnings=false
debug/terminate_on_errors=true
debug/development_lang="en"
ui/tooltip_follows_mouse=true
ui/dialogs_folder="res://game/ui/commons/dialogs"
ui/default_dialog_scene="res://game/ui/commons/dialogs/dialog_label.tscn"
ui/main_menu_scene="res://game/ui/commons/main_menu.tscn"
ui/game_scene="res://game/ui/ui_mouse_icons/game.tscn"
ui/game_scene="res://game/ui/ui_9verbs/game.tscn"
internals/save_data=""
[input]