diff --git a/CREDITS b/CREDITS index 87a8a71b..74b19d16 100644 --- a/CREDITS +++ b/CREDITS @@ -2,20 +2,39 @@ Assets ====== +Fonts +----- + +These fonts are provided as an example. Please mind checking the licence before redistributing with your game. + +- Caslon Antique +https://www.1001fonts.com/caslon-antique-font.html#license +Licence: Free for personal use - Free for commercial use +This is the font used in LucasArt's game Curse of Monkey Island. + +- Onesize +https://www.whatfontis.com/Onesize.font +Licence: Free for personal use +This is the font used in LucasArt's games The Secret of Monkey Island and Monkey Island 2: Lechuck's Revenge. + + Characters ---------- -- Mark spritesheet by Marco Giorgini - marcogiorgini.com (CC0 Licence) +- Mark spritesheet by Marco Giorgini - marcogiorgini.com +Licence : CC0 Licence https://opengameart.org/content/mark-2d-adventure-game-sprite with some additions (talk animations) by Julian Murgia -- Worker spritesheet based on Mark spritesheet by Marco Giorgini - marcogiorgini.com (CC0 Licence) +- Worker spritesheet based on Mark spritesheet by Marco Giorgini - marcogiorgini.com +Licence: CC0 Licence edited by Julian Murgia Items ----- -- Generic items by Kenney (CC0 Licence) +- Generic items by Kenney +Licence: CC0 Licence https://www.kenney.nl/assets/generic-items diff --git a/addons/escoria-core/editor/plugin_escoria.gd b/addons/escoria-core/editor/plugin_escoria.gd index bbe875a6..94e26f30 100644 --- a/addons/escoria-core/editor/plugin_escoria.gd +++ b/addons/escoria-core/editor/plugin_escoria.gd @@ -13,9 +13,7 @@ func _enter_tree(): load("res://addons/escoria-core/game/core-scripts/escbackground.gd"), null) add_custom_type("ESCCharacter", "KinematicBody2D", load("res://addons/escoria-core/game/core-scripts/esccharacter.gd"), null) - add_custom_type("ESCHotspot", "Area2D", - load("res://addons/escoria-core/game/core-scripts/eschotspot.gd"), null) - add_custom_type("ESCItem", "Sprite", + add_custom_type("ESCItem", "Area2D", load("res://addons/escoria-core/game/core-scripts/escitem.gd"), null) add_custom_type("ESCItemsInventory", "GridContainer", load("res://addons/escoria-core/game/core-scripts/items_inventory.gd"), null) @@ -148,7 +146,6 @@ func remove_autoloads(): func _exit_tree(): remove_custom_type("ESCBackground") remove_custom_type("ESCCharacter") - remove_custom_type("ESCHotspot") remove_custom_type("ESCItem") remove_custom_type("ESCInventoryItem") remove_custom_type("ESCItemsInventory") diff --git a/addons/escoria-core/game/core-scripts/behaviors/interactive.gd b/addons/escoria-core/game/core-scripts/behaviors/interactive.gd new file mode 100644 index 00000000..38c4d540 --- /dev/null +++ b/addons/escoria-core/game/core-scripts/behaviors/interactive.gd @@ -0,0 +1,4 @@ +extends Node + +func _ready(): + pass diff --git a/addons/escoria-core/game/core-scripts/behaviors/movable.gd b/addons/escoria-core/game/core-scripts/behaviors/movable.gd new file mode 100644 index 00000000..731d09a5 --- /dev/null +++ b/addons/escoria-core/game/core-scripts/behaviors/movable.gd @@ -0,0 +1,273 @@ +tool +extends Node +class_name Movable + +""" +This class performs the moving (walk, teleport, terrain scaling...) actions on +the parent node. +""" + + +onready var parent = get_parent() + +# If character misses an animation, bypass it and proceed. +onready var bypass_missing_animation = false + +func _ready(): + parent.add_user_signal("arrived") + +func _process(time): + if Engine.is_editor_hint(): + return + + if parent.task == parent.PLAYER_TASKS.WALK or parent.task == parent.PLAYER_TASKS.SLIDE: + var pos = parent.get_position() + var old_pos = pos + var next + if parent.walk_path.size() > 1: + next = parent.walk_path[parent.path_ofs + 1] + else: + next = parent.walk_path[parent.path_ofs] + + var dist = parent.speed * time * pow(parent.last_scale.x, 2) * \ + parent.terrain.player_speed_multiplier + if parent.walk_context and "fast" in parent.walk_context and parent.walk_context.fast: + dist *= parent.terrain.player_doubleclick_speed_multiplier + var dir = (next - pos).normalized() + + # assume that x^2 + y^2 == 1, apply v_speed_damp the y axis + #printt("dir before", dir) + dir = dir * (dir.x * dir.x + dir.y * dir.y * parent.v_speed_damp) + #printt("dir after", dir, dist) + + var new_pos + if pos.distance_to(next) < dist: + new_pos = next + parent.path_ofs += 1 + else: + new_pos = pos + dir * dist + + if parent.path_ofs >= parent.walk_path.size() - 1: + walk_stop(parent.walk_destination) + return + + pos = new_pos + + var angle = (old_pos.angle_to_point(pos)) + parent.set_position(pos) + + if parent.task == parent.PLAYER_TASKS.WALK: + parent.last_deg = escoria.utils._get_deg_from_rad(angle) + parent.last_dir = _get_dir_deg(parent.last_deg, parent.animations) + + var current_animation = "" + if parent.animation_sprite != null: + current_animation = parent.animation_sprite.animation +# elif animation != null: +# current_animation = animation.current_animation + + bypass_missing_animation = false + if !bypass_missing_animation: + var animation_to_play = parent.animations.directions[parent.last_dir][0] + if current_animation != animation_to_play: + if parent.animation_sprite.frames.has_animation(animation_to_play): + parent.animation_sprite.play(animation_to_play) + else: + bypass_missing_animation = true + current_animation = animation_to_play + escoria.report_warnings("movable.gd:_process()", + ["Character " + parent.global_id + " has no animation " + animation_to_play, + "Bypassing missing animation and proceed movement."]) + + parent.pose_scale = parent.animations.directions[parent.last_dir][1] + + update_terrain() + else: + parent.moved = false + set_process(false) + + +func teleport(target, angle : Object = null) -> void: + """ + Teleports the item on target position. + target can be Vector2 or Object + """ + if typeof(target) == TYPE_VECTOR2: + printt("Item teleported at position", target, "with angle", angle) + parent.position = target + elif typeof(target) == TYPE_OBJECT: + if target.get("interact_positions") != null: + parent.position = target.interact_positions.default #.global_position + else: + parent.position = target.position + printt("Item teleported at", target.name, "position", parent.position, "with angle", angle) + else: + escoria.report_errors("escitem.gd:teleport()", ["Target to teleport to is null or unusable (" + target + ")"]) + +# PUBLIC FUNCTION +func walk_to(pos : Vector2, p_walk_context = null): + if not parent.terrain: + return walk_stop(parent.get_position()) + + if parent.interact_status == parent.INTERACT_STATES.INTERACT_WALKING: + return + if parent.interact_status == parent.INTERACT_STATES.INTERACT_STARTED: + parent.interact_status = parent.INTERACT_STATES.INTERACT_WALKING + parent.walk_path = parent.terrain.get_terrain_path(parent.get_position(), pos) + parent.walk_context = p_walk_context + if parent.walk_path.size() == 0: + parent.task = parent.PLAYER_TASKS.NONE + walk_stop(parent.get_position()) + set_process(false) + return + parent.moved = true + parent.walk_destination = parent.walk_path[parent.walk_path.size()-1] + if parent.terrain.is_solid(pos): + parent.walk_destination = parent.walk_path[parent.walk_path.size()-1] + parent.path_ofs = 0.0 + parent.task = parent.PLAYER_TASKS.WALK + set_process(true) + +# PRIVATE FUNCTION +func walk(target_pos, p_speed, context = null): + if p_speed: + parent.orig_speed = parent.speed + parent.speed = p_speed + walk_to(target_pos, context) + +# PRIVATE FUNCTION +func walk_stop(pos): + parent.position = pos + parent.interact_status = parent.INTERACT_STATES.INTERACT_NONE + parent.walk_path = [] + + if parent.orig_speed: + parent.speed = parent.orig_speed + parent.orig_speed = 0.0 + + parent.task = parent.PLAYER_TASKS.NONE + parent.moved = false + set_process(false) + if parent.params_queue != null && !parent.params_queue.empty(): + if parent.animations.dir_angles.size() > 0: + if parent.arams_queue[0].interact_angle == -1: + escoria.tools.resolve_angle_to(parent.params_queue[0]) + else: + parent.last_dir = _get_dir_deg(parent.params_queue[0].interact_angle, parent.animations) + parent.animation_sprite.play(parent.animations.idles[parent.last_dir][0]) + parent.pose_scale = parent.animations.idles[parent.last_dir][1] + update_terrain() + else: + parent.animation_sprite.play(parent.animations.idles[parent.last_dir][0]) + parent.pose_scale = parent.animations.idles[parent.last_dir][1] + get_tree().call_group_flags(SceneTree.GROUP_CALL_DEFAULT, "game", "interact", parent.params_queue) + # Clear params queue to prevent the same action from being triggered again + parent.params_queue = [] + else: + + # If we're heading to an object and reached its interaction position, + # orient towards the defined interaction direction set on the object (if any) + if parent.walk_context.has("target_object") and parent.walk_context.target_object.player_orients_on_arrival \ + and escoria.esc_runner.get_interactive(parent.walk_context.target_object.global_id): + var orientation = parent.walk_context["target_object"].interaction_direction + parent.last_dir = orientation + parent.animation_sprite.play(parent.animations.idles[orientation][0]) + parent.pose_scale = parent.animations.idles[orientation][1] + else: + parent.animation_sprite.play(parent.animations.idles[parent.last_dir][0]) + parent.pose_scale = parent.animations.idles[parent.last_dir][1] + update_terrain() + + if parent.walk_context != null: +# escoria.esc_level_runner.finished(walk_context) + escoria.esc_level_runner.finished() + parent.walk_context = null + parent.emit_signal("arrived") + + +func update_terrain(on_event_finished_name = null): + if !parent.terrain or parent.terrain == null or !is_instance_valid(parent.terrain): + return + if on_event_finished_name != null and on_event_finished_name != "setup": + return + if parent.get("is_exit"): + return + + var pos = parent.position + parent.z_index = pos.y if pos.y <= VisualServer.CANVAS_ITEM_Z_MAX else VisualServer.CANVAS_ITEM_Z_MAX + + var color + if parent.terrain_is_scalenodes: + parent.last_scale = parent.terrain.get_terrain(pos) + parent.scale = parent.last_scale + elif parent.check_maps: + color = parent.terrain.get_terrain(pos) + var scal = parent.terrain.get_scale_range(color.b) + if scal != parent.get_scale(): + parent.last_scale = scal + parent.scale = parent.last_scale + + # Do not flip the entire player character, because that would conflict + # with shadows that expect to be siblings of $texture + if parent.pose_scale == -1 and parent.get_node("sprite").scale.x > 0: + parent.get_node("sprite").scale.x *= parent.pose_scale + parent.collision.scale.x *= parent.pose_scale + elif parent.pose_scale == 1 and parent.get_node("sprite").scale.x < 0: + parent.get_node("sprite").scale.x *= -1 + parent.collision.scale.x *= -1 + +# if parent.check_maps: +# color = parent.terrain.get_light(pos) +# +# if color: +# for s in sprites: +# s.set_modulate(color) + +func _get_dir(angle : float, animations) -> int: + var deg = escoria.utils._get_deg_from_rad(angle) + return _get_dir_deg(deg, animations) + + +func _get_dir_deg(deg : int, animations) -> int: + # We turn the angle by -90° because angle_to_point gives the angle against X axis, not Y + deg = wrapi(deg - 90, 0, 360) + var dir = -1 + var i = 0 + + for arr_angle_zone in animations.dir_angles: + if is_angle_in_interval(deg, arr_angle_zone): + dir = i + break + else: + i += 1 + continue + + # It's an error to have the animations misconfigured + if dir == -1: + escoria.report_errors("escitem.gd:_get_dir_deg()", ["No direction found for " + str(deg)]) + + return dir + +""" +Returns true if given angle is inside the interval given by a starting_angle and the size. +@param angle : Angle to test +@param: interval : Array of size 2, containing the starting angle, and the size of interval + eg: [90, 40] corresponds to angle between 90° and 130° +""" +func is_angle_in_interval(angle: float, interval : Array) -> bool: + angle = wrapi(angle, 0, 360) + if angle == 0: + angle = 360 + var start_angle = wrapi(interval[0], 0, 360) + var angle_area = interval[1] + var end_angle = wrapi(interval[0] + angle_area, 0, 360) + + if (angle >= 270 and angle <= 360) or (angle >= 0 and angle <= 90): + if wrapi(angle+180, 0, 360) > wrapi(interval[0]+ 180, 0, 360) \ + && wrapi(angle+180, 0, 360) <= wrapi(interval[0] + angle_area + 180, 0, 360): + return true + else: + if wrapi(angle, 0, 360) > start_angle && wrapi(angle, 0, 360) <= end_angle: + return true + + return false diff --git a/addons/escoria-core/game/core-scripts/esc/esc_runner_level.gd b/addons/escoria-core/game/core-scripts/esc/esc_runner_level.gd index 5c7d9140..c9fc0d47 100644 --- a/addons/escoria-core/game/core-scripts/esc/esc_runner_level.gd +++ b/addons/escoria-core/game/core-scripts/esc/esc_runner_level.gd @@ -449,7 +449,10 @@ func set_angle(command_params : Array): if !escoria.esc_runner.check_obj(command_params[0], "set_angle"): return esctypes.EVENT_LEVEL_STATE.RETURN var obj = escoria.esc_runner.get_object(command_params[0]) - obj.set_angle(int(command_params[1])) + # HACK Countering the fact that angle_to_point() function gives + # angle against X axis not Y, we need to check direction using (angle-90°). + # Since the ESC command already gives the right angle, we add 90. + obj.set_angle(int(command_params[1] + 90)) return esctypes.EVENT_LEVEL_STATE.RETURN diff --git a/addons/escoria-core/game/core-scripts/eschotspot.gd b/addons/escoria-core/game/core-scripts/eschotspot.gd deleted file mode 100644 index 6426d291..00000000 --- a/addons/escoria-core/game/core-scripts/eschotspot.gd +++ /dev/null @@ -1,148 +0,0 @@ -tool -extends Area2D -class_name ESCHotspot - -func get_class(): - return "ESCHotspot" - -""" -ESCHotspot is an Area2D (hotspot). -A hotspot is a simple area that can be defined by the user and is thus invisible -Usually, hotspots are used to define areas of the background that the player can -look at. -""" - -signal mouse_entered_hotspot(global_id) -signal mouse_exited_hotspot -signal mouse_left_clicked_hotspot(global_id, click_position) -signal mouse_double_left_clicked_hotspot(global_id, click_position) -signal mouse_right_clicked_hotspot(global_id, click_position) - -export(String) var global_id -export(bool) var is_exit -export(String, FILE, "*.esc") var esc_script -export(bool) var is_interactive = true -export(bool) var player_orients_on_arrival = true -export(ESCPlayer.Directions) var interaction_direction -export(String) var tooltip_name -export(String) var default_action -# If action used by player is in the list, game will wait for a second click on another item -# to combine objects together (typical USE WITH , GIVE TO ) -export(PoolStringArray) var combine_if_action_used_among = [] -export(Color) var dialog_color = ColorN("white") - -# Detected interact position set by a Position2D node OUTSIDE OF THE HOTSPOT SCENE. -# You have to add a child to the INSTANCED HOTSPOT SCENE, IN THE ROOM SCENE. -export(Dictionary) var interact_positions : Dictionary = { "default": null} - -var collision - -var terrain : ESCTerrain -# If the terrain node type is scalenodes -var terrain_is_scalenodes : bool -var check_maps = true -var pose_scale : int -var last_scale : Vector2 - -func _ready(): - if !Engine.is_editor_hint(): - escoria.register_object(self) - connect("mouse_entered_hotspot", escoria.inputs_manager, "_on_mouse_entered_hotspot") - connect("mouse_exited_hotspot", escoria.inputs_manager, "_on_mouse_exited_hotspot") - connect("mouse_left_clicked_hotspot", escoria.inputs_manager, "_on_mouse_left_clicked_hotspot") - connect("mouse_right_clicked_hotspot", escoria.inputs_manager, "_on_mouse_right_clicked_hotspot") - - 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() - terrain = escoria.room_terrain - - update_terrain() - - -func init_interact_position_with_node(): - """ - 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. - """ - 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 - break - if c is CollisionShape2D or c is CollisionPolygon2D: - interact_positions.default = c.global_position - - -func manage_input(viewport : Viewport, event : InputEvent, shape_idx : int): - if event is InputEventMouseButton: -# var p = get_global_mouse_position() - if event.doubleclick: - if event.button_index == BUTTON_LEFT: - emit_signal("mouse_double_left_clicked_hotspot", global_id, event) - else: - if event.is_pressed(): - if event.button_index == BUTTON_LEFT: - emit_signal("mouse_left_clicked_hotspot", global_id, event) - if event.button_index == BUTTON_RIGHT: - emit_signal("mouse_right_clicked_hotspot", global_id, event) - - -func _on_mouse_entered(): - emit_signal("mouse_entered_hotspot", global_id) - - -func _on_mouse_exited(): - emit_signal("mouse_exited_hotspot") - - -func get_item_child_if_any(): - for c in get_children(): - if c is ESCItem: - return c - - -func update_terrain(on_event_finished_name = null): - if !terrain: - return - if on_event_finished_name != null and on_event_finished_name != "setup": - return - if is_exit: - return - - var pos = position - z_index = pos.y if pos.y <= VisualServer.CANVAS_ITEM_Z_MAX else VisualServer.CANVAS_ITEM_Z_MAX - - var color - if terrain_is_scalenodes: - last_scale = terrain.get_terrain(pos) - self.scale = last_scale - elif check_maps: - color = terrain.get_terrain(pos) - var scal = terrain.get_scale_range(color.b) - if scal != get_scale(): - last_scale = scal - self.scale = last_scale - - # Do not flip the entire player character, because that would conflict - # with shadows that expect to be siblings of $"sprite" - if pose_scale == -1 and $"sprite".scale.x > 0: - $"sprite".scale.x *= pose_scale - collision.scale.x *= pose_scale - elif pose_scale == 1 and $"sprite".scale.x < 0: - $"sprite".scale.x *= -1 - collision.scale.x *= -1 - -# if check_maps: -# color = terrain.get_light(pos) -# -# if color: -# for s in sprites: -# s.set_modulate(color) diff --git a/addons/escoria-core/game/core-scripts/escitem.gd b/addons/escoria-core/game/core-scripts/escitem.gd index 661a9a32..fe830c54 100644 --- a/addons/escoria-core/game/core-scripts/escitem.gd +++ b/addons/escoria-core/game/core-scripts/escitem.gd @@ -1,5 +1,5 @@ tool -extends Sprite +extends Area2D class_name ESCItem func get_class(): @@ -15,6 +15,9 @@ signal mouse_left_clicked_item(global_id) signal mouse_double_left_clicked_item(global_id) signal mouse_right_clicked_item(global_id) +var Movable +var MovableScript = load("res://addons/escoria-core/game/core-scripts/behaviors/movable.gd") + export(String) var global_id export(String, FILE, "*.esc") var esc_script # If true, the ESC script may have an ":exit_scene" event to manage scene changes @@ -37,12 +40,15 @@ 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 - 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} + # Animation node (null if none was found) var animation_sprite -onready var interact_positions : Dictionary = { "default": null} # Animations script (for walking, idling...) export(Script) var animations @@ -84,9 +90,7 @@ var task # type PLAYER_TASKS var params_queue : Array - # PRIVATE VARS -var area : Area2D # Size of the item var size : Vector2 var last_deg : int @@ -94,6 +98,11 @@ var last_dir : int func _ready(): + # Adds movable behavior + Movable = Node.new() + Movable.set_script(MovableScript) + add_child(Movable) + for n in get_children(): if n is AnimatedSprite: animation_sprite = n @@ -101,14 +110,10 @@ func _ready(): if n is AnimationPlayer: animation_sprite = n continue - if n is Area2D: - area = n - continue - if area: - area.connect("mouse_entered", self, "_on_mouse_entered") - area.connect("mouse_exited", self, "_on_mouse_exited") - area.connect("input_event", self, "manage_input") + 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() terrain = escoria.room_terrain @@ -121,71 +126,9 @@ func _ready(): connect("mouse_double_left_clicked_item", escoria.inputs_manager, "_on_mouse_left_double_clicked_item") connect("mouse_right_clicked_item", escoria.inputs_manager, "_on_mouse_right_clicked_item") - update_terrain() - - -func _process(time): - if Engine.is_editor_hint(): - return - - if task == PLAYER_TASKS.WALK or task == PLAYER_TASKS.SLIDE: - var pos = get_position() - var old_pos = pos - var next - if walk_path.size() > 1: - next = walk_path[path_ofs + 1] - else: - next = walk_path[path_ofs] - - var dist = speed * time * pow(last_scale.x, 2) * terrain.player_speed_multiplier - if walk_context and "fast" in walk_context and walk_context.fast: - dist *= terrain.player_doubleclick_speed_multiplier - var dir = (next - pos).normalized() - - # assume that x^2 + y^2 == 1, apply v_speed_damp the y axis - #printt("dir before", dir) - dir = dir * (dir.x * dir.x + dir.y * dir.y * v_speed_damp) - #printt("dir after", dir, dist) - - var new_pos - if pos.distance_to(next) < dist: - new_pos = next - path_ofs += 1 - else: - new_pos = pos + dir * dist - - if path_ofs >= walk_path.size() - 1: - walk_stop(walk_destination) - return - - pos = new_pos - - var angle = (old_pos.angle_to_point(pos)) - set_position(pos) - - if task == PLAYER_TASKS.WALK: - last_deg = escoria.utils._get_deg_from_rad(angle) - last_dir = _get_dir_deg(last_deg, animations) - - var current_animation = "" - if animation_sprite != null: - current_animation = animation_sprite.animation -# elif animation != null: -# current_animation = animation.current_animation - - if current_animation != animations.directions[last_dir][0]: - animation_sprite.play(animations.directions[last_dir][0]) - - pose_scale = animations.directions[last_dir][1] - - update_terrain() - else: - moved = false - set_process(false) - - - - + if !is_exit: + last_scale = scale + Movable.update_terrain() func get_animation_player(): @@ -204,6 +147,7 @@ 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 @@ -211,9 +155,11 @@ func init_interact_position_with_node(): if c.get_owner() == self: continue interact_positions.default = c.global_position - break + if c is CollisionShape2D or c is CollisionPolygon2D: - interact_positions.default = c.global_position + collision = c + if interact_positions.default == null: + interact_positions.default = c.global_position func manage_input(viewport : Viewport, event : InputEvent, shape_idx : int): @@ -236,193 +182,22 @@ func _on_mouse_entered(): func _on_mouse_exited(): emit_signal("mouse_exited_item") -func update_terrain(on_event_finished_name = null): - if !terrain or terrain == null or !is_instance_valid(terrain): - return - if on_event_finished_name != null and on_event_finished_name != "setup": - return - if is_exit: - return - - var pos = position - var gpos = global_position - z_index = pos.y if pos.y <= VisualServer.CANVAS_ITEM_Z_MAX else VisualServer.CANVAS_ITEM_Z_MAX - - var color - if terrain_is_scalenodes: - last_scale = terrain.get_terrain(pos) - self.scale = last_scale - elif check_maps: - color = terrain.get_terrain(pos) - var scal = terrain.get_scale_range(color.b) - if scal != get_scale(): - last_scale = scal - self.scale = last_scale - - # Do not flip the entire player character, because that would conflict - # with shadows that expect to be siblings of $texture - if pose_scale == -1 and $texture.scale.x > 0: - $texture.scale.x *= pose_scale - collision.scale.x *= pose_scale - elif pose_scale == 1 and $texture.scale.x < 0: - $texture.scale.x *= -1 - collision.scale.x *= -1 - -# if check_maps: -# color = terrain.get_light(pos) -# -# if color: -# for s in sprites: -# s.set_modulate(color) - - +################################################################################ func teleport(target, angle : Object = null) -> void: - """ - Teleports the item on target position. - target can be Vector2 or Object - """ - if typeof(target) == TYPE_VECTOR2: - printt("Item teleported at position", target, "with angle", angle) - position = target - elif typeof(target) == TYPE_OBJECT: - if target.get("interact_positions") != null: - position = target.interact_positions.default #.global_position - else: - position = target.position - printt("Item teleported at", target.name, "position", position, "with angle", angle) - else: - escoria.report_errors("escitem.gd:teleport()", ["Target to teleport to is null or unusable (" + target + ")"]) + Movable.teleport(target, angle) -# PUBLIC FUNCTION func walk_to(pos : Vector2, p_walk_context = null): - if not terrain: - return walk_stop(get_position()) - - if interact_status == INTERACT_STATES.INTERACT_WALKING: - return - if interact_status == INTERACT_STATES.INTERACT_STARTED: - interact_status = INTERACT_STATES.INTERACT_WALKING - walk_path = terrain.get_terrain_path(get_position(), pos) - walk_context = p_walk_context - if walk_path.size() == 0: - task = PLAYER_TASKS.NONE - walk_stop(get_position()) - set_process(false) - return - moved = true - walk_destination = walk_path[walk_path.size()-1] - if terrain.is_solid(pos): - walk_destination = walk_path[walk_path.size()-1] - path_ofs = 0.0 - task = PLAYER_TASKS.WALK - set_process(true) - -# PRIVATE FUNCTION -func walk(target_pos, p_speed, context = null): - if p_speed: - orig_speed = speed - speed = p_speed - walk_to(target_pos, context) - -# PRIVATE FUNCTION -func walk_stop(pos): - position = pos - interact_status = INTERACT_STATES.INTERACT_NONE - walk_path = [] - - if orig_speed: - speed = orig_speed - orig_speed = 0.0 - - task = PLAYER_TASKS.NONE - moved = false - set_process(false) - if params_queue != null && !params_queue.empty(): - if animations.dir_angles.size() > 0: - if params_queue[0].interact_angle == -1: - escoria.tools.resolve_angle_to(params_queue[0]) - else: - last_dir = _get_dir_deg(params_queue[0].interact_angle, animations) - animation_sprite.play(animations.idles[last_dir][0]) - pose_scale = animations.idles[last_dir][1] - update_terrain() - else: - animation_sprite.play(animations.idles[last_dir][0]) - pose_scale = animations.idles[last_dir][1] - get_tree().call_group_flags(SceneTree.GROUP_CALL_DEFAULT, "game", "interact", params_queue) - # Clear params queue to prevent the same action from being triggered again - params_queue = [] - else: - - # If we're heading to an object and reached its interaction position, - # orient towards the defined interaction direction set on the object (if any) - if walk_context.has("target_object") and walk_context.target_object.player_orients_on_arrival \ - and escoria.esc_runner.get_interactive(walk_context.target_object.global_id): - var orientation = walk_context["target_object"].interaction_direction - animation_sprite.play(animations.idles[orientation][0]) - pose_scale = animations.idles[orientation][1] - else: - animation_sprite.play(animations.idles[last_dir][0]) - pose_scale = animations.idles[last_dir][1] - update_terrain() - - if walk_context != null: -# escoria.esc_level_runner.finished(walk_context) - escoria.esc_level_runner.finished() - walk_context = null - emit_signal("arrived") - - -func _get_dir(angle : float, animations) -> int: - var deg = escoria.utils._get_deg_from_rad(angle) - return _get_dir_deg(deg, animations) - - -func _get_dir_deg(deg : int, animations) -> int: - # We turn the angle by -90° because angle_to_point gives the angle against X axis, not Y - deg = wrapi(deg - 90, 0, 360) - var dir = -1 - var i = 0 - - for arr_angle_zone in animations.dir_angles: - if is_angle_in_interval(deg, arr_angle_zone): - dir = i - break - else: - i += 1 - continue - - # It's an error to have the animations misconfigured - if dir == -1: - escoria.report_errors("escitem.gd:_get_dir_deg()", ["No direction found for " + str(deg)]) - - return dir - -""" -Returns true if given angle is inside the interval given by a starting_angle and the size. -@param angle : Angle to test -@param: interval : Array of size 2, containing the starting angle, and the size of interval - eg: [90, 40] corresponds to angle between 90° and 130° -""" -func is_angle_in_interval(angle: float, interval : Array) -> bool: - angle = wrapi(angle, 0, 360) - if angle == 0: - angle = 360 - var start_angle = wrapi(interval[0], 0, 360) - var angle_area = interval[1] - var end_angle = wrapi(interval[0] + angle_area, 0, 360) - - if (angle >= 270 and angle <= 360) or (angle >= 0 and angle <= 90): - if wrapi(angle+180, 0, 360) > wrapi(interval[0]+ 180, 0, 360) \ - && wrapi(angle+180, 0, 360) <= wrapi(interval[0] + angle_area + 180, 0, 360): - return true - else: - if wrapi(angle, 0, 360) > start_angle && wrapi(angle, 0, 360) <= end_angle: - return true - - return false - + Movable.walk_to(pos, p_walk_context) +func start_talking(): +# if animation_sprite.is_playing(): +# animation_sprite.stop() +# animation_sprite.play(animations.speaks[last_dir][0]) + pass +func stop_talking(): +# if animation_sprite.is_playing(): +# animation_sprite.stop() + pass diff --git a/addons/escoria-core/game/core-scripts/escoria_types.gd b/addons/escoria-core/game/core-scripts/escoria_types.gd index c6726a7c..c00e3dc3 100644 --- a/addons/escoria-core/game/core-scripts/escoria_types.gd +++ b/addons/escoria-core/game/core-scripts/escoria_types.gd @@ -5,7 +5,6 @@ const OBJ_DEFAULT_STATE = "default" ## Custom nodes: #var ESCBackground = preload("res://addons/escoria-core/game/core-scripts/escbackground.gd") #var ESCCharacter = preload("res://addons/escoria-core/game/core-scripts/esccharacter.gd") -#var ESCHotspot = preload("res://addons/escoria-core/game/core-scripts/eschotspot.gd") #var ESCItem = preload("res://addons/escoria-core/game/core-scripts/escitem.gd") #var ESCItemsInventory = preload("res://addons/escoria-core/game/core-scripts/items_inventory.gd") #var ESCInventoryItem = preload("res://addons/escoria-core/game/core-scripts/inventory_item.gd") diff --git a/addons/escoria-core/game/core-scripts/escplayer.gd b/addons/escoria-core/game/core-scripts/escplayer.gd index 05481a1f..e39d24b8 100644 --- a/addons/escoria-core/game/core-scripts/escplayer.gd +++ b/addons/escoria-core/game/core-scripts/escplayer.gd @@ -5,7 +5,15 @@ class_name ESCPlayer func get_class(): return "ESCPlayer" -signal arrived +""" +TODO +- Currently the sprite node needs to be named "sprite". This is bad. +- Animation management doesn't allow using AnimationPlayer yet. Need to find + the best solution to manage both AnimatedSprite and AnimationPlayer. +""" + +var Movable : Node +var MovableScript = load("res://addons/escoria-core/game/core-scripts/behaviors/movable.gd") export var global_id : String @@ -87,9 +95,15 @@ export(NodePath) var camera_position_node func _ready(): + # Adds movable behavior + Movable = Node.new() + Movable.set_script(MovableScript) + add_child(Movable) + + # Connect the player to the event_done signal, so we can react to a finished # ":setup" event. In this case, we need to run update_terrain() - escoria.esc_runner.connect("event_done", self, "update_terrain") + escoria.esc_runner.connect("event_done", Movable, "update_terrain") # assert(is_angle_in_interval(0, [340,40])) # true # assert(is_angle_in_interval(359, [340,40])) # true @@ -125,7 +139,6 @@ func _ready(): return terrain = escoria.room_terrain - last_scale = scale set_process(true) @@ -136,272 +149,153 @@ func _process(time): return $debug.text = str(z_index) - if task == PLAYER_TASKS.WALK or task == PLAYER_TASKS.SLIDE: - var pos = get_position() - var old_pos = pos - var next - if walk_path.size() > 1: - next = walk_path[path_ofs + 1] - else: - next = walk_path[path_ofs] - - var dist = speed * time * pow(last_scale.x, 2) * terrain.player_speed_multiplier - if walk_context and "fast" in walk_context and walk_context.fast: - dist *= terrain.player_doubleclick_speed_multiplier - var dir = (next - pos).normalized() - - # assume that x^2 + y^2 == 1, apply v_speed_damp the y axis - #printt("dir before", dir) - dir = dir * (dir.x * dir.x + dir.y * dir.y * v_speed_damp) - #printt("dir after", dir, dist) - - var new_pos - if pos.distance_to(next) < dist: - new_pos = next - path_ofs += 1 - else: - new_pos = pos + dir * dist - - if path_ofs >= walk_path.size() - 1: - walk_stop(walk_destination) - return - - pos = new_pos - - var angle = (old_pos.angle_to_point(pos)) - set_position(pos) - - if task == PLAYER_TASKS.WALK: - last_deg = escoria.utils._get_deg_from_rad(angle) - last_dir = _get_dir_deg(last_deg, animations) - - var current_animation = "" - if animation_sprite != null: - current_animation = animation_sprite.animation -# elif animation != null: -# current_animation = animation.current_animation - - if current_animation != animations.directions[last_dir][0]: - animation_sprite.play(animations.directions[last_dir][0]) - - pose_scale = animations.directions[last_dir][1] - - update_terrain() - else: - moved = false - set_process(false) - - -func update_terrain(on_event_finished_name = null): - if !terrain: - return - if on_event_finished_name != null and on_event_finished_name != "setup": - return - - var pos = position - z_index = pos.y if pos.y <= VisualServer.CANVAS_ITEM_Z_MAX else VisualServer.CANVAS_ITEM_Z_MAX - - var color - if terrain_is_scalenodes: - last_scale = terrain.get_terrain(pos) - self.scale = last_scale - elif check_maps: - color = terrain.get_terrain(pos) - var scal = terrain.get_scale_range(color.b) - if scal != get_scale(): - last_scale = scal - self.scale = last_scale - - # Do not flip the entire player character, because that would conflict - # with shadows that expect to be siblings of $"sprite" - if pose_scale == -1 and $"sprite".scale.x > 0: - $"sprite".scale.x *= pose_scale - collision.scale.x *= pose_scale - elif pose_scale == 1 and $"sprite".scale.x < 0: - $"sprite".scale.x *= -1 - collision.scale.x *= -1 - -# if check_maps: -# color = terrain.get_light(pos) +# if task == PLAYER_TASKS.WALK or task == PLAYER_TASKS.SLIDE: +# var pos = get_position() +# var old_pos = pos +# var next +# if walk_path.size() > 1: +# next = walk_path[path_ofs + 1] +# else: +# next = walk_path[path_ofs] # -# if color: -# for s in sprites: -# s.set_modulate(color) +# var dist = speed * time * pow(last_scale.x, 2) * terrain.player_speed_multiplier +# if walk_context and "fast" in walk_context and walk_context.fast: +# dist *= terrain.player_doubleclick_speed_multiplier +# var dir = (next - pos).normalized() +# +# # assume that x^2 + y^2 == 1, apply v_speed_damp the y axis +# #printt("dir before", dir) +# dir = dir * (dir.x * dir.x + dir.y * dir.y * v_speed_damp) +# #printt("dir after", dir, dist) +# +# var new_pos +# if pos.distance_to(next) < dist: +# new_pos = next +# path_ofs += 1 +# else: +# new_pos = pos + dir * dist +# +# if path_ofs >= walk_path.size() - 1: +# walk_stop(walk_destination) +# return +# +# pos = new_pos +# +# var angle = (old_pos.angle_to_point(pos)) +# set_position(pos) +# +# if task == PLAYER_TASKS.WALK: +# last_deg = escoria.utils._get_deg_from_rad(angle) +# last_dir = _get_dir_deg(last_deg, animations) +# +# var current_animation = "" +# if animation_sprite != null: +# current_animation = animation_sprite.animation +## elif animation != null: +## current_animation = animation.current_animation +# +# if current_animation != animations.directions[last_dir][0]: +# animation_sprite.play(animations.directions[last_dir][0]) +# +# pose_scale = animations.directions[last_dir][1] +# +# update_terrain() +# else: +# moved = false +# set_process(false) + + +#func update_terrain(on_event_finished_name = null): +# if !terrain: +# return +# if on_event_finished_name != null and on_event_finished_name != "setup": +# return +# +# var pos = position +# z_index = pos.y if pos.y <= VisualServer.CANVAS_ITEM_Z_MAX else VisualServer.CANVAS_ITEM_Z_MAX +# +# var color +# if terrain_is_scalenodes: +# last_scale = terrain.get_terrain(pos) +# self.scale = last_scale +# elif check_maps: +# color = terrain.get_terrain(pos) +# var scal = terrain.get_scale_range(color.b) +# if scal != get_scale(): +# last_scale = scal +# self.scale = last_scale +# +# # Do not flip the entire player character, because that would conflict +# # with shadows that expect to be siblings of $"sprite" +# if pose_scale == -1 and $"sprite".scale.x > 0: +# $"sprite".scale.x *= pose_scale +# collision.scale.x *= pose_scale +# elif pose_scale == 1 and $"sprite".scale.x < 0: +# $"sprite".scale.x *= -1 +# collision.scale.x *= -1 +# +## if check_maps: +## color = terrain.get_light(pos) +## +## if color: +## for s in sprites: +## s.set_modulate(color) """ Sets player angle and plays according animation. +- deg int angle to set the character +- immediate bool (currently unused, see TODO below) + If true, direction is switched immediately. Else, successive animations are + used so that the character turns to target angle. + +TODO: depending on current angle and current angle, the character may directly turn around +with no "progression". We may enhance this by calculating successive directions to turn the +character to, so that he doesn't switch to opposite direction too fast. +For example, if character looks WEST and set_angle(EAST) is called, we may want the character +to first turn SOUTHWEST, then SOUTH, then SOUTHEAST and finally EAST, all more or less fast. +Whatever the implementation, this should be activated using "parameter "immediate" set to false. """ -func set_angle(deg): +func set_angle(deg : int, immediate = true): if deg < 0 or deg > 360: escoria.report_errors("escplayer.gd:set_angle()", ["Invalid degree to turn to " + str(deg)]) moved = true last_deg = deg - last_dir = _get_dir_deg(deg, animations) + last_dir = Movable._get_dir_deg(deg, animations) # The player may have a state animation from before, which would be # resumed, so we immediately force the correct idle animation if animation_sprite.animation != animations.idles[last_dir][0]: animation_sprite.play(animations.idles[last_dir][0]) pose_scale = animations.idles[last_dir][1] - update_terrain() - -""" -Teleports the player on target position. -target can be Vector2 or Object -""" -func teleport(target, angle : Object = null) -> void: - if typeof(target) == TYPE_VECTOR2: - printt("Player teleported at position", target, "with angle", angle) - position = target - elif typeof(target) == TYPE_OBJECT: - if target.get("interact_positions") != null: - position = target.interact_positions.default #.global_position - else: - position = target.position - printt("Player teleported at", target.name, "position", position, "with angle", angle) - else: - escoria.report_errors("escplayer.gd", ["target to teleport player to is null or unusable (" + target + ")"]) - -# PUBLIC FUNCTION -func walk_to(pos : Vector2, p_walk_context = null): - if not terrain: - return walk_stop(get_position()) - - if interact_status == INTERACT_STATES.INTERACT_WALKING: - return - if interact_status == INTERACT_STATES.INTERACT_STARTED: - interact_status = INTERACT_STATES.INTERACT_WALKING - walk_path = terrain.get_terrain_path(get_position(), pos) - walk_context = p_walk_context - if walk_path.size() == 0: - task = PLAYER_TASKS.NONE - walk_stop(get_position()) - set_process(false) - return - moved = true - walk_destination = walk_path[walk_path.size()-1] - if terrain.is_solid(pos): - walk_destination = walk_path[walk_path.size()-1] - path_ofs = 0.0 - task = PLAYER_TASKS.WALK - set_process(true) - -# PRIVATE FUNCTION -func walk(target_pos, p_speed, context = null): - if p_speed: - orig_speed = speed - speed = p_speed - walk_to(target_pos, context) - -# PRIVATE FUNCTION -func walk_stop(pos): - position = pos - interact_status = INTERACT_STATES.INTERACT_NONE - walk_path = [] - - if orig_speed: - speed = orig_speed - orig_speed = 0.0 - - task = PLAYER_TASKS.NONE - moved = false - set_process(false) - if params_queue != null && !params_queue.empty(): - if animations.dir_angles.size() > 0: - if params_queue[0].interact_angle == -1: - escoria.tools.resolve_angle_to(params_queue[0]) - else: - last_dir = _get_dir_deg(params_queue[0].interact_angle, animations) - animation_sprite.play(animations.idles[last_dir][0]) - pose_scale = animations.idles[last_dir][1] - update_terrain() - else: - animation_sprite.play(animations.idles[last_dir][0]) - pose_scale = animations.idles[last_dir][1] - get_tree().call_group_flags(SceneTree.GROUP_CALL_DEFAULT, "game", "interact", params_queue) - # Clear params queue to prevent the same action from being triggered again - params_queue = [] - else: - - # If we're heading to an object and reached its interaction position, - # orient towards the defined interaction direction set on the object (if any) - if walk_context.has("target_object") and walk_context.target_object.player_orients_on_arrival \ - and escoria.esc_runner.get_interactive(walk_context.target_object.global_id): - var orientation = walk_context["target_object"].interaction_direction - animation_sprite.play(animations.idles[orientation][0]) - pose_scale = animations.idles[orientation][1] - else: - animation_sprite.play(animations.idles[last_dir][0]) - pose_scale = animations.idles[last_dir][1] - update_terrain() - - if walk_context != null: - escoria.esc_level_runner.finished(walk_context) - walk_context = null - emit_signal("arrived") + Movable.update_terrain() func anim_finished(): pass - 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 - func get_animations_list() -> PoolStringArray: return animation_sprite.get_sprite_frames().get_animation_names() +func start_talking(): + if animation_sprite.is_playing(): + animation_sprite.stop() + animation_sprite.play(animations.speaks[last_dir][0]) -func _get_dir(angle : float, animations) -> int: - var deg = escoria.utils._get_deg_from_rad(angle) - return _get_dir_deg(deg, animations) +func stop_talking(): + if animation_sprite.is_playing(): + animation_sprite.stop() + animation_sprite.play(animations.idles[last_dir][0]) -func _get_dir_deg(deg : int, animations) -> int: - # We turn the angle by -90° because angle_to_point gives the angle against X axis, not Y - deg = wrapi(deg - 90, 0, 360) - var dir = -1 - var i = 0 - - for arr_angle_zone in animations.dir_angles: - if is_angle_in_interval(deg, arr_angle_zone): - dir = i - break - else: - i += 1 - continue - - # It's an error to have the animations misconfigured - if dir == -1: - escoria.report_errors("escplayer.gd:_get_dir_deg()", ["No direction found for " + str(deg)]) - - return dir +func teleport(target, angle : Object = null) -> void: + Movable.teleport(target, angle) -# Returns true if given angle is inside the interval given by a starting_angle and the size. -# @param angle : Angle to test -# @param: interval : Array of size 2, containing the starting angle, and the size of interval -# eg: [90, 40] corresponds to angle between 90° and 130° -func is_angle_in_interval(angle: float, interval : Array) -> bool: - angle = wrapi(angle, 0, 360) - if angle == 0: - angle = 360 - var start_angle = wrapi(interval[0], 0, 360) - var angle_area = interval[1] - var end_angle = wrapi(interval[0] + angle_area, 0, 360) - - if (angle >= 270 and angle <= 360) or (angle >= 0 and angle <= 90): - if wrapi(angle+180, 0, 360) > wrapi(interval[0]+ 180, 0, 360) \ - && wrapi(angle+180, 0, 360) <= wrapi(interval[0] + angle_area + 180, 0, 360): - return true - else: - if wrapi(angle, 0, 360) > start_angle && wrapi(angle, 0, 360) <= end_angle: - return true - - return false - - +func walk_to(pos : Vector2, p_walk_context = null): + Movable.walk_to(pos, p_walk_context) diff --git a/addons/escoria-core/game/escoria.gd b/addons/escoria-core/game/escoria.gd index 9f8833e2..9cfb1f20 100644 --- a/addons/escoria-core/game/escoria.gd +++ b/addons/escoria-core/game/escoria.gd @@ -151,14 +151,14 @@ func do(action : String, params : Array = []) -> void: moving_obj.walk_to(target_position, walk_context) - "hotspot_left_click", "item_left_click": + "item_left_click": if params[0] is String: printt("escoria.do : item_left_click on item ", params[0]) # call : ev_left_click_on_item() ev_left_click_on_item($esc_runner.get_object(params[0]), params[1]) - "hotspot_right_click", "item_right_click": + "item_right_click": if params[0] is String: printt("escoria.do : item_right_click on item ", params[0]) @@ -257,6 +257,6 @@ func ev_left_click_on_item(obj, event, default_action = false): else: esc_runner.activate(esc_runner.current_action, [obj]) - else: -# escoria.fallback("") - pass +# else: +## escoria.fallback("") +# pass diff --git a/addons/escoria-core/game/inputs_manager.gd b/addons/escoria-core/game/inputs_manager.gd index d3862892..7bc28f96 100644 --- a/addons/escoria-core/game/inputs_manager.gd +++ b/addons/escoria-core/game/inputs_manager.gd @@ -31,30 +31,6 @@ func _on_right_click_on_bg(position : Vector2): ################################################################################## -func _on_mouse_entered_hotspot(hotspot_global_id : String) -> void: - printt("Hotspot focused : ", hotspot_global_id) - is_hotspot_focused = true - escoria.main.current_scene.game.element_focused(hotspot_global_id) - -func _on_mouse_exited_hotspot() -> void: - print("Hotspot unfocused") - is_hotspot_focused = false - escoria.main.current_scene.game.element_unfocused() - -func _on_mouse_left_clicked_hotspot(hotspot_global_id : String, event : InputEvent) -> void: - printt("Hotspot left clicked", hotspot_global_id, event) - escoria.main.current_scene.game.left_click_on_hotspot(hotspot_global_id, event) - -func _on_mouse_right_clicked_hotspot(hotspot_global_id : String, event : InputEvent) -> void: - printt("Hotspot right clicked", hotspot_global_id, event) - escoria.main.current_scene.game.right_click_on_hotspot(hotspot_global_id, event) - -func _on_mouse_left_double_clicked_hotspot(hotspot_global_id : String, event : InputEvent) -> void: - printt("Hotspot right clicked", hotspot_global_id, event) - escoria.main.current_scene.game.left_double_click_on_hotspot(hotspot_global_id, event) - -################################################################################## - func _on_mouse_left_click_inventory_item(inventory_item_global_id, event : InputEvent) -> void: printt("Inventory item left clicked ", inventory_item_global_id) escoria.main.current_scene.game.left_click_on_inventory_item(inventory_item_global_id, event) diff --git a/addons/escoria-core/game/main.gd b/addons/escoria-core/game/main.gd index 693ec2df..719941c4 100644 --- a/addons/escoria-core/game/main.gd +++ b/addons/escoria-core/game/main.gd @@ -166,10 +166,6 @@ func check_game_scene_methods(): assert(current_scene.game.has_method("element_focused")) assert(current_scene.game.has_method("element_unfocused")) - assert(current_scene.game.has_method("left_click_on_hotspot")) - assert(current_scene.game.has_method("right_click_on_hotspot")) - assert(current_scene.game.has_method("left_double_click_on_hotspot")) - assert(current_scene.game.has_method("left_click_on_item")) assert(current_scene.game.has_method("right_click_on_item")) assert(current_scene.game.has_method("left_double_click_on_item")) diff --git a/addons/escoria-core/game/scenes/dialogs/dialog_player.gd b/addons/escoria-core/game/scenes/dialogs/dialog_player.gd index c630476c..c897ee11 100644 --- a/addons/escoria-core/game/scenes/dialogs/dialog_player.gd +++ b/addons/escoria-core/game/scenes/dialogs/dialog_player.gd @@ -48,6 +48,7 @@ func say(character : String, params : Dictionary): dialog_ui = get_resource(params.ui).instance() get_parent().add_child(dialog_ui) dialog_ui.say(character, params) + func finish_fast(): dialog_ui.finish_fast() diff --git a/addons/escoria-core/template_scenes/dialog_scenes/dialog_label.gd b/addons/escoria-core/template_scenes/dialog_scenes/dialog_label.gd index d8ac179b..bf3a4c08 100644 --- a/addons/escoria-core/template_scenes/dialog_scenes/dialog_label.gd +++ b/addons/escoria-core/template_scenes/dialog_scenes/dialog_label.gd @@ -1,8 +1,8 @@ extends RichTextLabel -signal dialog_line_finished +#signal dialog_line_started +#signal dialog_line_finished -export(String) var current_character onready var tween = $Tween onready var text_node = self @@ -10,6 +10,10 @@ export(float, 0.0, 0.3) var text_speed_per_character = 0.1 export(float) var fast_text_speed_per_character = 0.25 export(float) var max_time_to_text_disappear = 2.0 +# Current character speaking, to keep track of reference for animation purposes +var current_character + + func _ready(): bbcode_enabled = true $Tween.connect("tween_completed", self, "_on_dialog_line_typed") @@ -29,15 +33,17 @@ func say(character : String, params : Dictionary) : return # Position the RichTextLabel on the character's dialog position, if any. - var character_node = escoria.esc_runner.get_object(character) - rect_position = character_node.get_node("dialog_position").get_global_transform_with_canvas().origin + current_character = escoria.esc_runner.get_object(character) + rect_position = current_character.get_node("dialog_position").get_global_transform_with_canvas().origin rect_position.x -= rect_size.x / 2 + current_character.start_talking() + # Set text color to color set in the actor - var text_color = character_node.dialog_color + var text_color = current_character.dialog_color var text_color_html = text_color.to_html(false) - text_node.bbcode_text = "[center][color=#" + text_color_html + "]".format(text_color_html) + params["line"] + "[/color][center]" + text_node.bbcode_text = "[center][color=#" + text_color_html + "]".format([text_color_html]) + params["line"] + "[/color][center]" text_node.percent_visible = 0.0 var time_show_full_text = text_speed_per_character * len(params["line"]) @@ -61,7 +67,7 @@ func _on_dialog_line_typed(object, key): $Timer.connect("timeout", self, "_on_dialog_finished") func _on_dialog_finished(): -# emit_signal("dialog_line_finished") + current_character.stop_talking() escoria.esc_level_runner.finished() escoria.dialog_player.is_speaking = false escoria.current_state = escoria.GAME_STATE.DEFAULT diff --git a/addons/escoria-core/template_scenes/room.tscn b/addons/escoria-core/template_scenes/room.tscn index 4fbd6cab..21b7f934 100644 --- a/addons/escoria-core/template_scenes/room.tscn +++ b/addons/escoria-core/template_scenes/room.tscn @@ -2,13 +2,14 @@ [ext_resource path="res://addons/escoria-core/game/core-scripts/escterrain.gd" type="Script" id=1] [ext_resource path="res://addons/escoria-core/game/core-scripts/escbackground.gd" type="Script" id=2] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=3] +[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=3] [ext_resource path="res://addons/escoria-core/game/core-scripts/escroom.gd" type="Script" id=4] [sub_resource type="NavigationPolygon" id=1] [node name="room" type="Node2D"] script = ExtResource( 4 ) +camera_limits = [ Rect2( 0, 0, 1289, 555 ) ] [node name="ESCBackground" type="TextureRect" parent="."] margin_right = 40.0 @@ -27,9 +28,9 @@ navpoly = SubResource( 1 ) [node name="Hotspots" type="Node2D" parent="."] -[node name="ESCHotspot" type="Area2D" parent="Hotspots"] +[node name="ESCItem" type="Area2D" parent="Hotspots"] script = ExtResource( 3 ) dialog_color = Color( 1, 1, 1, 1 ) - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/ESCHotspot"] -polygon = PoolVector2Array( 105, 65, 157, 47, 186, 118, 87, 134, 77, 87 ) +interact_positions = { +"default": null +} diff --git a/game/assets_sources/mark/mark.ase b/game/assets_sources/mark/mark.ase index 16c639db..f60219f5 100644 Binary files a/game/assets_sources/mark/mark.ase and b/game/assets_sources/mark/mark.ase differ diff --git a/game/assets_sources/worker/worker.ase b/game/assets_sources/worker/worker.ase index c04afc60..7cd3f3a0 100644 Binary files a/game/assets_sources/worker/worker.ase and b/game/assets_sources/worker/worker.ase differ diff --git a/game/assets_sources/worker/worker_talk_down.ase b/game/assets_sources/worker/worker_talk_down.ase index f0a951ea..f85e6838 100644 Binary files a/game/assets_sources/worker/worker_talk_down.ase and b/game/assets_sources/worker/worker_talk_down.ase differ diff --git a/game/characters/mark/mark.tscn b/game/characters/mark/mark.tscn index 7b5488f8..a04d0589 100644 --- a/game/characters/mark/mark.tscn +++ b/game/characters/mark/mark.tscn @@ -9,197 +9,197 @@ [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 ) +atlas = ExtResource( 4 ) +region = Rect2( 48, 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( 144, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=5] -atlas = ExtResource( 4 ) -region = Rect2( 168, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=6] -atlas = ExtResource( 4 ) -region = Rect2( 192, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=7] -atlas = ExtResource( 4 ) -region = Rect2( 96, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=8] -atlas = ExtResource( 4 ) -region = Rect2( 24, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=9] -atlas = ExtResource( 4 ) -region = Rect2( 216, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=10] -atlas = ExtResource( 4 ) -region = Rect2( 240, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=11] -atlas = ExtResource( 4 ) -region = Rect2( 264, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=12] -atlas = ExtResource( 4 ) -region = Rect2( 288, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=13] -atlas = ExtResource( 4 ) -region = Rect2( 312, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=14] -atlas = ExtResource( 7 ) -region = Rect2( 0, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=15] -atlas = ExtResource( 7 ) -region = Rect2( 24, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=16] -atlas = ExtResource( 7 ) -region = Rect2( 48, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=17] -atlas = ExtResource( 7 ) -region = Rect2( 72, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=18] -atlas = ExtResource( 7 ) -region = Rect2( 96, 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( 4 ) region = Rect2( 120, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=21] +[sub_resource type="AtlasTexture" id=3] atlas = ExtResource( 4 ) region = Rect2( 72, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=22] +[sub_resource type="AtlasTexture" id=4] atlas = ExtResource( 5 ) region = Rect2( 0, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=23] +[sub_resource type="AtlasTexture" id=5] atlas = ExtResource( 5 ) region = Rect2( 24, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=24] +[sub_resource type="AtlasTexture" id=6] atlas = ExtResource( 5 ) region = Rect2( 48, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=25] +[sub_resource type="AtlasTexture" id=7] atlas = ExtResource( 4 ) region = Rect2( 0, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=26] +[sub_resource type="AtlasTexture" id=8] atlas = ExtResource( 4 ) region = Rect2( 336, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=27] +[sub_resource type="AtlasTexture" id=9] atlas = ExtResource( 4 ) region = Rect2( 360, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=28] +[sub_resource type="AtlasTexture" id=10] atlas = ExtResource( 4 ) region = Rect2( 384, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=29] +[sub_resource type="AtlasTexture" id=11] atlas = ExtResource( 6 ) region = Rect2( 0, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=30] +[sub_resource type="AtlasTexture" id=12] atlas = ExtResource( 6 ) region = Rect2( 24, 0, 24, 70 ) +[sub_resource type="AtlasTexture" id=13] +atlas = ExtResource( 2 ) +region = Rect2( 0, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=14] +atlas = ExtResource( 2 ) +region = Rect2( 24, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=15] +atlas = ExtResource( 2 ) +region = Rect2( 48, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=16] +atlas = ExtResource( 4 ) +region = Rect2( 144, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=17] +atlas = ExtResource( 4 ) +region = Rect2( 168, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=18] +atlas = ExtResource( 4 ) +region = Rect2( 192, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=19] +atlas = ExtResource( 4 ) +region = Rect2( 96, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=20] +atlas = ExtResource( 4 ) +region = Rect2( 24, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=21] +atlas = ExtResource( 4 ) +region = Rect2( 216, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=22] +atlas = ExtResource( 4 ) +region = Rect2( 240, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=23] +atlas = ExtResource( 4 ) +region = Rect2( 264, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=24] +atlas = ExtResource( 4 ) +region = Rect2( 288, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=25] +atlas = ExtResource( 4 ) +region = Rect2( 312, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=26] +atlas = ExtResource( 7 ) +region = Rect2( 0, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=27] +atlas = ExtResource( 7 ) +region = Rect2( 24, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=28] +atlas = ExtResource( 7 ) +region = Rect2( 48, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=29] +atlas = ExtResource( 7 ) +region = Rect2( 72, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=30] +atlas = ExtResource( 7 ) +region = Rect2( 96, 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 ), SubResource( 5 ), SubResource( 6 ) ], -"loop": true, -"name": "walk_down", -"speed": 6.0 -}, { -"frames": [ SubResource( 7 ) ], -"loop": true, -"name": "idle_left", -"speed": 5.0 -}, { -"frames": [ SubResource( 8 ) ], -"loop": true, -"name": "idle_down_right", -"speed": 5.0 -}, { -"frames": [ SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ) ], -"loop": true, -"name": "walk_right", -"speed": 6.0 -}, { -"frames": [ SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ) ], -"loop": true, -"name": "speak_right", -"speed": 5.0 -}, { -"frames": [ SubResource( 19 ) ], +"frames": [ SubResource( 1 ) ], "loop": true, "name": "idle_right", "speed": 5.0 }, { -"frames": [ SubResource( 20 ) ], +"frames": [ SubResource( 2 ) ], "loop": true, "name": "idle_down_left", "speed": 5.0 }, { -"frames": [ SubResource( 21 ) ], +"frames": [ SubResource( 3 ) ], "loop": true, "name": "idle_up", "speed": 5.0 }, { -"frames": [ SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ], +"frames": [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ], "loop": true, "name": "speak_down_right", "speed": 6.0 }, { -"frames": [ SubResource( 25 ) ], +"frames": [ SubResource( 7 ) ], "loop": true, "name": "idle_down", "speed": 5.0 }, { -"frames": [ SubResource( 26 ), SubResource( 27 ), SubResource( 28 ) ], +"frames": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ) ], "loop": true, "name": "walk_up", "speed": 6.0 }, { -"frames": [ SubResource( 29 ), SubResource( 30 ), SubResource( 29 ), SubResource( 30 ), SubResource( 30 ) ], +"frames": [ SubResource( 11 ), SubResource( 12 ), SubResource( 11 ), SubResource( 12 ), SubResource( 12 ) ], "loop": true, "name": "speak_up", "speed": 3.0 +}, { +"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 14 ), SubResource( 15 ) ], +"loop": true, +"name": "speak_down", +"speed": 6.0 +}, { +"frames": [ SubResource( 16 ), SubResource( 17 ), SubResource( 18 ) ], +"loop": true, +"name": "walk_down", +"speed": 6.0 +}, { +"frames": [ SubResource( 19 ) ], +"loop": true, +"name": "idle_left", +"speed": 5.0 +}, { +"frames": [ SubResource( 20 ) ], +"loop": true, +"name": "idle_down_right", +"speed": 5.0 +}, { +"frames": [ SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 25 ) ], +"loop": true, +"name": "walk_right", +"speed": 6.0 +}, { +"frames": [ SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ), SubResource( 30 ) ], +"loop": true, +"name": "speak_right", +"speed": 5.0 } ] [sub_resource type="CapsuleShape2D" id=32] height = 0.0 -[node name="character" type="KinematicBody2D"] +[node name="mark" type="KinematicBody2D"] script = ExtResource( 1 ) global_id = "player" animations = ExtResource( 3 ) @@ -209,7 +209,7 @@ dialog_color = Color( 1, 1, 1, 1 ) position = Vector2( 0, -140.938 ) scale = Vector2( 4, 4 ) frames = SubResource( 31 ) -animation = "speak_right" +animation = "idle_down" [node name="collision" type="CollisionShape2D" parent="."] shape = SubResource( 32 ) diff --git a/game/characters/worker/worker.tscn b/game/characters/worker/worker.tscn index 4f7203db..b20249e4 100644 --- a/game/characters/worker/worker.tscn +++ b/game/characters/worker/worker.tscn @@ -1,32 +1,47 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=7 format=2] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=2] +[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=1] +[ext_resource path="res://game/characters/worker/worker_anims.gd" type="Script" id=2] [ext_resource path="res://game/characters/worker/png/worker.png" type="Texture" id=4] -[sub_resource type="RectangleShape2D" id=1] +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 4 ) +region = Rect2( 0, 0, 24, 70 ) + +[sub_resource type="SpriteFrames" id=2] +animations = [ { +"frames": [ SubResource( 1 ) ], +"loop": true, +"name": "idle_front", +"speed": 5.0 +} ] + +[sub_resource type="RectangleShape2D" id=3] extents = Vector2( 40.4907, 142.11 ) [node name="worker" type="Area2D"] -script = ExtResource( 2 ) +script = ExtResource( 1 ) global_id = "worker" -interaction_direction = 3 -dialog_color = Color( 1, 1, 1, 1 ) +esc_script = "res://game/rooms/room6/esc/worker.esc" +tooltip_name = "Worker" +default_action = "look" +dialog_color = Color( 0.196078, 0, 1, 1 ) interact_positions = { -"default": null +"default": Vector2( -1.662, -141.108 ) } +animations = ExtResource( 2 ) -[node name="sprite" type="Sprite" parent="."] -position = Vector2( 0.0280151, -0.221287 ) +[node name="sprite" type="AnimatedSprite" parent="."] +position = Vector2( 0.0280151, -16.7213 ) scale = Vector2( 4, 4 ) -texture = ExtResource( 4 ) +frames = SubResource( 2 ) +animation = "idle_front" offset = Vector2( -0.0280151, -30.9602 ) -hframes = 24 -region_rect = Rect2( 0, 0, 25, 70 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2( -1.162, -120.608 ) -shape = SubResource( 1 ) +position = Vector2( -1.662, -141.108 ) +shape = SubResource( 3 ) -[node name="dialog_pos" type="Position2D" parent="."] -position = Vector2( 0.0280151, -310.487 ) +[node name="dialog_position" type="Position2D" parent="."] +position = Vector2( 0.0280151, -352.44 ) scale = Vector2( 4, 4 ) diff --git a/game/items/ESCORIA_ALL_ITEMS.tscn b/game/items/ESCORIA_ALL_ITEMS.tscn index 59416988..3857b663 100644 --- a/game/items/ESCORIA_ALL_ITEMS.tscn +++ b/game/items/ESCORIA_ALL_ITEMS.tscn @@ -11,12 +11,25 @@ visible = false script = ExtResource( 5 ) [node name="empty_sheet" parent="." instance=ExtResource( 1 )] +interact_positions = { +"default": Vector2( 0, 0 ) +} [node name="filled_sheet" parent="." instance=ExtResource( 4 )] position = Vector2( -29.7823, 133.569 ) +dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( -29.7823, 133.569 ) +} [node name="pen" parent="." instance=ExtResource( 2 )] position = Vector2( 136.277, 13.5374 ) +interact_positions = { +"default": Vector2( 136.277, 13.5374 ) +} [node name="wrench" parent="." instance=ExtResource( 3 )] position = Vector2( 293.311, 2.70747 ) +interact_positions = { +"default": Vector2( 293.311, 2.70747 ) +} diff --git a/game/items/escitems/empty_sheet_escitem.tscn b/game/items/escitems/empty_sheet_escitem.tscn index e5c9e954..6a3b98b7 100644 --- a/game/items/escitems/empty_sheet_escitem.tscn +++ b/game/items/escitems/empty_sheet_escitem.tscn @@ -7,21 +7,23 @@ [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 86.9568, 115.211 ) -[node name="empty_sheet" type="Sprite"] -texture = ExtResource( 2 ) +[node name="empty_sheet" type="Area2D"] script = ExtResource( 1 ) global_id = "r5_empty_sheet" esc_script = "res://game/items/escitems/empty_sheet.esc" -tooltip_name = "Sheet" +tooltip_name = "Empty sheet" default_action = "look" -combine_if_action_used_among = PoolStringArray( "use" ) +combine_if_action_used_among = PoolStringArray( "use", "give" ) use_from_inventory_only = true inventory_item_scene_file = ExtResource( 3 ) -dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": null +} -[node name="Area2D" type="Area2D" parent="."] +[node name="sprite" type="Sprite" parent="."] +texture = ExtResource( 2 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] rotation = 0.0218604 scale = Vector2( 0.683022, 0.519355 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] shape = SubResource( 1 ) diff --git a/game/items/escitems/filled_sheet.esc b/game/items/escitems/filled_sheet.esc index 59a6983c..1a9cdb75 100755 --- a/game/items/escitems/filled_sheet.esc +++ b/game/items/escitems/filled_sheet.esc @@ -2,21 +2,4 @@ say player "'Dear Escoria developer: I hope you're having fun right now!'" stop -:use android -say player "I'll give you this!" -:give android -inventory_remove r5_filled_sheet - -say android "Hey! That's perfect!" -say android "I can finally get away from here!" -walk_to_pos android 1200 400 -#set_angle android 45 - -# Open the door -set_state r6_door r_door_open -set_global r6_door_open true - -# Disappear! -wait 1 -set_active android false diff --git a/game/items/escitems/filled_sheet_escitem.tscn b/game/items/escitems/filled_sheet_escitem.tscn index 7da2d14f..cbca5f6d 100644 --- a/game/items/escitems/filled_sheet_escitem.tscn +++ b/game/items/escitems/filled_sheet_escitem.tscn @@ -1,15 +1,25 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=1] [ext_resource path="res://game/items/inventory/filled_sheet_escinventoryitem.tscn" type="PackedScene" id=2] -[node name="filled_sheet" type="Sprite"] +[sub_resource type="RectangleShape2D" id=1] + +[node name="filled_sheet" type="Area2D"] script = ExtResource( 1 ) global_id = "r5_filled_sheet" esc_script = "res://game/items/escitems/filled_sheet.esc" tooltip_name = "Filled sheet" -default_action = "look" combine_if_action_used_among = PoolStringArray( "use", "give" ) +combine_is_one_way = true use_from_inventory_only = true inventory_item_scene_file = ExtResource( 2 ) dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 0, 0 ) +} + +[node name="sprite" type="Sprite" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) diff --git a/game/items/escitems/pen_escitem.tscn b/game/items/escitems/pen_escitem.tscn index fc9ee92d..ecee8f78 100644 --- a/game/items/escitems/pen_escitem.tscn +++ b/game/items/escitems/pen_escitem.tscn @@ -7,20 +7,21 @@ [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 51.8881, 43.8187 ) -[node name="pen" type="Sprite"] -texture = ExtResource( 2 ) +[node name="pen" type="Area2D"] script = ExtResource( 1 ) global_id = "r5_pen" esc_script = "res://game/items/escitems/pen.esc" tooltip_name = "Pen" default_action = "look" -combine_if_action_used_among = PoolStringArray( "use" ) -combine_is_one_way = true +combine_if_action_used_among = PoolStringArray( "use", "give" ) use_from_inventory_only = true inventory_item_scene_file = ExtResource( 3 ) -dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": null +} -[node name="Area2D" type="Area2D" parent="."] +[node name="pen" type="Sprite" parent="."] +texture = ExtResource( 2 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) diff --git a/game/items/escitems/wrench.esc b/game/items/escitems/wrench.esc index 61f1b852..8d8286c7 100755 --- a/game/items/escitems/wrench.esc +++ b/game/items/escitems/wrench.esc @@ -7,10 +7,4 @@ stop set_global i/r5_wrench true set_active r5_wrench false -:use r5_wall_item -> [r5_wall_item_state_round] - set_state r5_wall_item state_square - set_global r5_wall_item_state_round false - stop -set_state r5_wall_item state_round -set_global r5_wall_item_state_round true + diff --git a/game/items/escitems/wrench_escitem.tscn b/game/items/escitems/wrench_escitem.tscn index f7efe9dd..7670ce5e 100644 --- a/game/items/escitems/wrench_escitem.tscn +++ b/game/items/escitems/wrench_escitem.tscn @@ -7,19 +7,22 @@ [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 44.696, 49.0953 ) -[node name="wrench" type="Sprite"] -texture = ExtResource( 2 ) +[node name="wrench" type="Area2D"] script = ExtResource( 1 ) global_id = "r5_wrench" esc_script = "res://game/items/escitems/wrench.esc" tooltip_name = "Wrench" default_action = "look" -combine_if_action_used_among = PoolStringArray( "use", "give" ) +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="Area2D" type="Area2D" parent="."] +[node name="sprite" type="Sprite" parent="."] +texture = ExtResource( 2 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) diff --git a/game/rooms/desk/bg.jpg b/game/rooms/desk/bg.jpg deleted file mode 100755 index ce23d47b..00000000 Binary files a/game/rooms/desk/bg.jpg and /dev/null differ diff --git a/game/rooms/desk/bg.jpg.import b/game/rooms/desk/bg.jpg.import deleted file mode 100644 index 6695f596..00000000 --- a/game/rooms/desk/bg.jpg.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/bg.jpg-c05998b5c4c94e3181be5910834f8a7a.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://game/rooms/desk/bg.jpg" -dest_files=[ "res://.import/bg.jpg-c05998b5c4c94e3181be5910834f8a7a.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/game/rooms/desk/depth.png b/game/rooms/desk/depth.png deleted file mode 100755 index d9a1e792..00000000 Binary files a/game/rooms/desk/depth.png and /dev/null differ diff --git a/game/rooms/desk/depth.png.import b/game/rooms/desk/depth.png.import deleted file mode 100644 index c0df618a..00000000 --- a/game/rooms/desk/depth.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/depth.png-53b6a3375b1fe23fe3829c714c23daed.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://game/rooms/desk/depth.png" -dest_files=[ "res://.import/depth.png-53b6a3375b1fe23fe3829c714c23daed.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/game/rooms/desk/desk.png b/game/rooms/desk/desk.png deleted file mode 100755 index e22d926f..00000000 Binary files a/game/rooms/desk/desk.png and /dev/null differ diff --git a/game/rooms/desk/desk.png.import b/game/rooms/desk/desk.png.import deleted file mode 100644 index e6a9d2f6..00000000 --- a/game/rooms/desk/desk.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/desk.png-3e7a06cea8b1de679348c692b6cf0d92.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://game/rooms/desk/desk.png" -dest_files=[ "res://.import/desk.png-3e7a06cea8b1de679348c692b6cf0d92.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/game/rooms/desk/esc/frame.esc b/game/rooms/desk/esc/frame.esc deleted file mode 100755 index a6d7278e..00000000 --- a/game/rooms/desk/esc/frame.esc +++ /dev/null @@ -1,2 +0,0 @@ -:look_at - say player "Creepy." diff --git a/game/rooms/desk/esc/statue.esc b/game/rooms/desk/esc/statue.esc deleted file mode 100755 index 242a625b..00000000 --- a/game/rooms/desk/esc/statue.esc +++ /dev/null @@ -1,2 +0,0 @@ -:look_at - say player "Some kind of... Roman bust?" diff --git a/game/rooms/desk/maskInvertAlpha.png b/game/rooms/desk/maskInvertAlpha.png deleted file mode 100755 index e8a38c80..00000000 Binary files a/game/rooms/desk/maskInvertAlpha.png and /dev/null differ diff --git a/game/rooms/desk/maskInvertAlpha.png.import b/game/rooms/desk/maskInvertAlpha.png.import deleted file mode 100644 index 625910b7..00000000 --- a/game/rooms/desk/maskInvertAlpha.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/maskInvertAlpha.png-65d56d1d52e4f95a942ff10e1d3d1010.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://game/rooms/desk/maskInvertAlpha.png" -dest_files=[ "res://.import/maskInvertAlpha.png-65d56d1d52e4f95a942ff10e1d3d1010.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/game/rooms/desk/maskInvertAlphaBgTransp.png b/game/rooms/desk/maskInvertAlphaBgTransp.png deleted file mode 100755 index 06fa60c7..00000000 Binary files a/game/rooms/desk/maskInvertAlphaBgTransp.png and /dev/null differ diff --git a/game/rooms/desk/maskInvertAlphaBgTransp.png.import b/game/rooms/desk/maskInvertAlphaBgTransp.png.import deleted file mode 100644 index 2583082b..00000000 --- a/game/rooms/desk/maskInvertAlphaBgTransp.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/maskInvertAlphaBgTransp.png-b52a09c6a9464873445eeb2d3d917587.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://game/rooms/desk/maskInvertAlphaBgTransp.png" -dest_files=[ "res://.import/maskInvertAlphaBgTransp.png-b52a09c6a9464873445eeb2d3d917587.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/game/rooms/desk/maskInvertAlphaBlack.png b/game/rooms/desk/maskInvertAlphaBlack.png deleted file mode 100755 index 8888f713..00000000 Binary files a/game/rooms/desk/maskInvertAlphaBlack.png and /dev/null differ diff --git a/game/rooms/desk/maskInvertAlphaBlack.png.import b/game/rooms/desk/maskInvertAlphaBlack.png.import deleted file mode 100644 index d3846e49..00000000 --- a/game/rooms/desk/maskInvertAlphaBlack.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/maskInvertAlphaBlack.png-8ac7b82205e2fe94807ea647bc880b71.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://game/rooms/desk/maskInvertAlphaBlack.png" -dest_files=[ "res://.import/maskInvertAlphaBlack.png-8ac7b82205e2fe94807ea647bc880b71.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/game/rooms/desk/maskInvertAlpha_desk.png b/game/rooms/desk/maskInvertAlpha_desk.png deleted file mode 100755 index ccc981ec..00000000 Binary files a/game/rooms/desk/maskInvertAlpha_desk.png and /dev/null differ diff --git a/game/rooms/desk/maskInvertAlpha_desk.png.import b/game/rooms/desk/maskInvertAlpha_desk.png.import deleted file mode 100644 index 2c653b78..00000000 --- a/game/rooms/desk/maskInvertAlpha_desk.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/maskInvertAlpha_desk.png-7af79e3af637db25f511819e82ddc3d4.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://game/rooms/desk/maskInvertAlpha_desk.png" -dest_files=[ "res://.import/maskInvertAlpha_desk.png-7af79e3af637db25f511819e82ddc3d4.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/game/rooms/desk/maskInvertAlpha_table.png b/game/rooms/desk/maskInvertAlpha_table.png deleted file mode 100755 index dbc3d450..00000000 Binary files a/game/rooms/desk/maskInvertAlpha_table.png and /dev/null differ diff --git a/game/rooms/desk/maskInvertAlpha_table.png.import b/game/rooms/desk/maskInvertAlpha_table.png.import deleted file mode 100644 index 5a5a4e53..00000000 --- a/game/rooms/desk/maskInvertAlpha_table.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/maskInvertAlpha_table.png-ed9e2266d7cd867c794a2d8ace7ca633.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://game/rooms/desk/maskInvertAlpha_table.png" -dest_files=[ "res://.import/maskInvertAlpha_table.png-ed9e2266d7cd867c794a2d8ace7ca633.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/game/rooms/desk/room1.tscn b/game/rooms/desk/room1.tscn deleted file mode 100644 index 76954a22..00000000 --- a/game/rooms/desk/room1.tscn +++ /dev/null @@ -1,82 +0,0 @@ -[gd_scene load_steps=7 format=2] - -[ext_resource path="res://game/rooms/room1/bg.jpg" type="Texture" id=1] -[ext_resource path="res://addons/escoria-core/game/core-scripts/escbackground.gd" type="Script" id=2] -[ext_resource path="res://game/rooms/room1/depth.png" type="Texture" id=4] -[ext_resource path="res://addons/escoria-core/game/core-scripts/escterrain.gd" type="Script" id=5] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=6] - - - - - - -[sub_resource type="NavigationPolygon" id=1] -vertices = PoolVector2Array( 1023.73, 538.618, 1065.84, 538.618, 1124.56, 569.643, 1035.92, 578.507, 1021.52, 554.13, 863.067, 617.288, 864.175, 577.399, 935.089, 554.13, 338.967, 544.158, 917.36, 537.51, 533.981, 574.075, 1269.71, 664.934, 1271.93, 796.789, 59.7424, 797.898, 1138.97, 660.501, 535.089, 617.288 ) -polygons = [ PoolIntArray( 0, 1, 2, 3, 4 ), PoolIntArray( 4, 3, 5, 6, 7 ), PoolIntArray( 8, 9, 7, 6, 10 ), PoolIntArray( 11, 12, 13, 14 ), PoolIntArray( 3, 14, 13, 5 ), PoolIntArray( 15, 5, 13 ), PoolIntArray( 15, 13, 8, 10 ) ] -outlines = [ PoolVector2Array( 59.7424, 797.898, 338.967, 544.158, 917.36, 537.51, 935.089, 554.13, 1021.52, 554.13, 1023.73, 538.618, 1065.84, 538.618, 1124.56, 569.643, 1035.92, 578.507, 1138.97, 660.501, 1269.71, 664.934, 1271.93, 796.789 ), PoolVector2Array( 535.089, 617.288, 863.067, 617.288, 864.175, 577.399, 533.981, 574.075 ) ] - -[node name="room1" type="Node2D"] - -[node name="ESCBackground" type="TextureRect" parent="."] -margin_right = 1280.0 -margin_bottom = 800.0 -mouse_filter = 2 -mouse_default_cursor_shape = 3 -texture = ExtResource( 1 ) -script = ExtResource( 2 ) -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="ESCTerrain" type="Navigation2D" parent="."] -script = ExtResource( 5 ) -scales = ExtResource( 4 ) -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 = 0 -scale_min = 0.3 -scale_max = 1.0 - -[node name="area" type="NavigationPolygonInstance" parent="ESCTerrain"] -navpoly = SubResource( 1 ) - -[node name="Hotspots" type="Node2D" parent="."] - -[node name="statue" type="Area2D" parent="Hotspots"] -script = ExtResource( 6 ) -label = "Statue" -esc_script = "res://game/rooms/room1/esc/statue.esc" - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/statue"] -polygon = PoolVector2Array( 970.546, 309.255, 951.709, 310.363, 938.413, 333.632, 934.421, 370.158, 938.413, 406.762, 1004.95, 407, 1008.22, 364.656, 999.354, 336.956, 990.373, 311.675 ) - -[node name="action_position" type="Position2D" parent="Hotspots/statue"] -position = Vector2( 975.388, 568.636 ) - -[node name="frame" type="Area2D" parent="Hotspots"] -script = ExtResource( 6 ) -label = "Frame" -esc_script = "res://game/rooms/room1/esc/statue.esc" - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/frame"] -position = Vector2( 278.877, -156.443 ) -polygon = PoolVector2Array( 936.229, 322.724, 930.788, 549.906, 997.446, 555.348, 996.085, 305.039 ) - -[node name="action_position" type="Position2D" parent="Hotspots/frame"] -position = Vector2( 1025.72, 624.412 ) - -[node name="shelves" type="Area2D" parent="Hotspots"] -script = ExtResource( 6 ) -label = "Frame" -esc_script = "res://game/rooms/room1/esc/statue.esc" - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/shelves"] -position = Vector2( 278.877, -156.443 ) -polygon = PoolVector2Array( -235.053, 315.922, -233.693, 933.532, 43.8235, 698.187, 42.4632, 385.301 ) - -[node name="action_position" type="Position2D" parent="Hotspots/shelves"] -position = Vector2( 390.427, 604.006 ) diff --git a/game/rooms/desk/spot.png b/game/rooms/desk/spot.png deleted file mode 100755 index 9ab2d349..00000000 Binary files a/game/rooms/desk/spot.png and /dev/null differ diff --git a/game/rooms/desk/spot.png.import b/game/rooms/desk/spot.png.import deleted file mode 100644 index d0bb16a5..00000000 --- a/game/rooms/desk/spot.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/spot.png-2a0d0627ef965975f9fd24b0d5dc2047.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://game/rooms/desk/spot.png" -dest_files=[ "res://.import/spot.png-2a0d0627ef965975f9fd24b0d5dc2047.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/game/rooms/desk/table.png b/game/rooms/desk/table.png deleted file mode 100755 index ae4c38c0..00000000 Binary files a/game/rooms/desk/table.png and /dev/null differ diff --git a/game/rooms/desk/table.png.import b/game/rooms/desk/table.png.import deleted file mode 100644 index 732fb400..00000000 --- a/game/rooms/desk/table.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/table.png-ebc0ba6ad031512024d0938ea7f0e908.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://game/rooms/desk/table.png" -dest_files=[ "res://.import/table.png-ebc0ba6ad031512024d0938ea7f0e908.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/game/rooms/room1/room1.tscn b/game/rooms/room1/room1.tscn index ba5195e7..21a589a3 100644 --- a/game/rooms/room1/room1.tscn +++ b/game/rooms/room1/room1.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://game/rooms/room1/walkable_area.tscn" type="PackedScene" id=1] [ext_resource path="res://game/rooms/room1/background.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=3] +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=3] [ext_resource path="res://game/characters/mark/mark.tscn" type="PackedScene" id=4] +[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=5] [ext_resource path="res://addons/escoria-core/game/core-scripts/escroom.gd" type="Script" id=6] [node name="room1" type="Node2D"] @@ -23,18 +24,34 @@ margin_left = 371.033 margin_top = 214.057 margin_right = 551.033 margin_bottom = 245.057 +custom_fonts/font = ExtResource( 3 ) text = "Move : left click Fast move : double left click" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="room_label" type="Label" parent="background"] +margin_right = 40.0 +margin_bottom = 14.0 +custom_fonts/font = ExtResource( 3 ) +text = "ROOM 1" +__meta__ = { +"_edit_use_anchors_": false +} [node name="walkable_area" parent="." instance=ExtResource( 1 )] [node name="Hotspots" type="Node2D" parent="."] [node name="r_door" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) +script = ExtResource( 5 ) +__meta__ = { +"_editor_description_": "" +} global_id = "r1_r_exit" -is_exit = true esc_script = "res://game/rooms/room1/esc/right_exit.esc" +is_exit = true tooltip_name = "Exit" dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { @@ -48,10 +65,11 @@ polygon = PoolVector2Array( 1177.94, 348.61, 1175.95, 45.3759, 1276.06, 92.0953, position = Vector2( 1225.47, 353.99 ) [node name="item" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) -global_id = "r1_item" +script = ExtResource( 5 ) +global_id = "r1_wall_item" esc_script = "res://game/rooms/room1/esc/wall_item.esc" tooltip_name = "Item on the wall" +default_action = "look" dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 671.798, 373.035 ) diff --git a/game/rooms/room2/background.tscn b/game/rooms/room2/background.tscn index 0858a428..562718bf 100644 --- a/game/rooms/room2/background.tscn +++ b/game/rooms/room2/background.tscn @@ -45,6 +45,5 @@ visible = false polygon = PoolVector2Array( 343.993, 396.767, 323.298, 415.689, 344.585, 438.158, 365.872, 417.463 ) [node name="bridge" parent="." instance=ExtResource( 2 )] -player_orients_on_arrival = false [editable path="bridge"] diff --git a/game/rooms/room2/bridge.tscn b/game/rooms/room2/bridge.tscn index 724a6d41..0ffc93c7 100644 --- a/game/rooms/room2/bridge.tscn +++ b/game/rooms/room2/bridge.tscn @@ -32,11 +32,15 @@ tracks/0/keys = { "values": [ Vector2( 1.417, -160.142 ), Vector2( 0, 0 ) ] } -[node name="bridge" type="Sprite"] +[node name="bridge" type="Area2D"] script = ExtResource( 1 ) global_id = "r2_bridge" is_interactive = false +player_orients_on_arrival = false dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 0, 0 ) +} [node name="bridge_lines" type="Line2D" parent="."] position = Vector2( -2.36194, -105.8 ) @@ -46,7 +50,5 @@ points = PoolVector2Array( 496.624, 640.806, 823.362, 644.635, 856.546, 776.097, anims/bridge_close = SubResource( 1 ) anims/bridge_open = SubResource( 2 ) -[node name="area" type="Area2D" parent="."] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="area"] +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] polygon = PoolVector2Array( 493.501, 532.894, 463.501, 670.894, 861.501, 670.894, 823.501, 530.894 ) diff --git a/game/rooms/room2/room2.tscn b/game/rooms/room2/room2.tscn index 932e1429..4848267c 100644 --- a/game/rooms/room2/room2.tscn +++ b/game/rooms/room2/room2.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://game/rooms/room2/walkable_area.tscn" type="PackedScene" id=1] [ext_resource path="res://game/rooms/room2/background.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=3] +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=3] [ext_resource path="res://game/characters/mark/mark.tscn" type="PackedScene" id=4] [ext_resource path="res://addons/escoria-core/game/core-scripts/escroom.gd" type="Script" id=6] [ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=7] @@ -15,24 +15,30 @@ script = ExtResource( 6 ) global_id = "room2" esc_script = "res://game/rooms/room2/esc/room2_bridge.esc" player_scene = ExtResource( 4 ) +camera_limits = [ Rect2( 0, 0, 1289, 555 ) ] [node name="walkable_area" parent="." instance=ExtResource( 1 )] [node name="background" parent="." instance=ExtResource( 2 )] +[node name="room_label" type="Label" parent="background"] +margin_right = 40.0 +margin_bottom = 14.0 +custom_fonts/font = ExtResource( 3 ) +text = "ROOM 2" +__meta__ = { +"_edit_use_anchors_": false +} + [node name="Hotspots" type="Node2D" parent="."] [node name="r_platform" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) +script = ExtResource( 7 ) global_id = "r2_right_platform" -is_exit = false esc_script = "res://game/rooms/room2/esc/right_platform.esc" -is_interactive = true -player_orients_on_arrival = true interaction_direction = 3 tooltip_name = "Right platform" -default_action = "" -combine_if_action_used_among = PoolStringArray( ) +default_action = "look" dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 430.893, 451.052 ) @@ -45,16 +51,10 @@ polygon = PoolVector2Array( 870.974, 538.342, 827.536, 353.995, 1181.4, 357.174, position = Vector2( 430.893, 451.052 ) [node name="r_door" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) +script = ExtResource( 7 ) global_id = "r2_r_exit" -is_exit = true esc_script = "res://game/rooms/room2/esc/right_exit.esc" -is_interactive = true -player_orients_on_arrival = true -interaction_direction = 0 -tooltip_name = "Exit" -default_action = "" -combine_if_action_used_among = PoolStringArray( ) +is_exit = true dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 1225.47, 353.99 ) @@ -67,16 +67,10 @@ polygon = PoolVector2Array( 1177.94, 348.61, 1175.95, 45.3759, 1276.06, 92.0953, position = Vector2( 1225.47, 353.99 ) [node name="l_door" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) +script = ExtResource( 7 ) global_id = "r2_l_exit" -is_exit = true esc_script = "res://game/rooms/room2/esc/left_exit.esc" -is_interactive = true -player_orients_on_arrival = true -interaction_direction = 0 -tooltip_name = "Exit" -default_action = "" -combine_if_action_used_among = PoolStringArray( ) +is_exit = true dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 52.1462, 384.691 ) @@ -88,18 +82,19 @@ polygon = PoolVector2Array( -1.37926, 443.158, 7.96461, 122.796, 84.0504, 77.411 [node name="Position2D" type="Position2D" parent="Hotspots/l_door"] position = Vector2( 52.1462, 384.691 ) -[node name="button_left" type="Sprite" parent="Hotspots"] +[node name="button_left" type="Area2D" parent="Hotspots"] script = ExtResource( 7 ) global_id = "r2_button" esc_script = "res://game/rooms/room2/esc/button.esc" -tooltip_name = "button" +tooltip_name = "Button" default_action = "use" -dialog_color = Color( 0.219608, 0, 1, 1 ) +dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 338.117, 370.025 ) +} -[node name="Area2D" type="Area2D" parent="Hotspots/button_left"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="Hotspots/button_left"] position = Vector2( 346.507, 150.721 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Hotspots/button_left/Area2D"] shape = SubResource( 1 ) [node name="action_pos" type="Position2D" parent="Hotspots/button_left"] @@ -108,26 +103,26 @@ position = Vector2( 338.117, 370.025 ) [node name="dialog_position" type="Position2D" parent="Hotspots/button_left"] position = Vector2( 333.879, 84.4147 ) -[node name="button_right" type="Sprite" parent="Hotspots"] -position = Vector2( 624.705, 0 ) +[node name="button_right" type="Area2D" parent="Hotspots"] script = ExtResource( 7 ) global_id = "r2_button_right" esc_script = "res://game/rooms/room2/esc/button.esc" -tooltip_name = "button" +tooltip_name = "Button" default_action = "use" -dialog_color = Color( 0.219608, 0, 1, 1 ) +dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 962.822, 370.025 ) +} -[node name="Area2D" type="Area2D" parent="Hotspots/button_right"] -position = Vector2( 346.507, 150.721 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Hotspots/button_right/Area2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="Hotspots/button_right"] +position = Vector2( 971.212, 150.721 ) shape = SubResource( 1 ) [node name="action_pos" type="Position2D" parent="Hotspots/button_right"] -position = Vector2( 338.117, 370.025 ) +position = Vector2( 962.822, 370.025 ) [node name="dialog_position" type="Position2D" parent="Hotspots/button_right"] -position = Vector2( 333.879, 84.4147 ) +position = Vector2( 958.584, 84.4147 ) [node name="player_start" type="Position2D" parent="."] position = Vector2( 76.7617, 437.649 ) diff --git a/game/rooms/room3/background.tscn b/game/rooms/room3/background.tscn index 3d7eabe8..6a8c4a77 100644 --- a/game/rooms/room3/background.tscn +++ b/game/rooms/room3/background.tscn @@ -93,13 +93,20 @@ points = PoolVector2Array( 1175.07, 620.086, 1171.24, 311.267, 1274.8, 356.87, 1 [node name="bridge" parent="." instance=ExtResource( 2 )] global_id = "r3_bridge" +interact_positions = { +"default": Vector2( 0, 0 ) +} -[node name="button" type="Sprite" parent="."] +[node name="button" type="Area2D" parent="."] script = ExtResource( 4 ) global_id = "r3_button" esc_script = "res://game/rooms/room3/esc/button.esc" -tooltip_name = "button" +tooltip_name = "Button" +default_action = "use" dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 347.767, 378.011 ) +} [node name="lines" type="Line2D" parent="button"] position = Vector2( 0, -266.591 ) @@ -128,7 +135,5 @@ anims/button_repaired = SubResource( 7 ) [node name="interact_pos" type="Position2D" parent="button"] position = Vector2( 347.767, 378.011 ) -[node name="area" type="Area2D" parent="button"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="button/area"] +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="button"] polygon = PoolVector2Array( 319.633, 122.126, 320.427, 177.685, 371.224, 176.098, 372.811, 121.332 ) diff --git a/game/rooms/room3/button.tscn b/game/rooms/room3/button.tscn index 64d6e725..cf36c020 100644 --- a/game/rooms/room3/button.tscn +++ b/game/rooms/room3/button.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=2] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=1] +[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=1] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 28.6442, 23.5021 ) @@ -38,10 +38,16 @@ tracks/0/keys = { [node name="button" type="Area2D"] position = Vector2( 346.18, 151.013 ) script = ExtResource( 1 ) +__meta__ = { +"_editor_description_": "" +} global_id = "button" esc_script = "res://game/rooms/room3/esc/button.esc" tooltip_name = "Button" dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 346.18, 151.013 ) +} [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource( 1 ) diff --git a/game/rooms/room3/esc/room3_bridge.esc b/game/rooms/room3/esc/room3_bridge.esc index 5e712609..9cfa8de5 100644 --- a/game/rooms/room3/esc/room3_bridge.esc +++ b/game/rooms/room3/esc/room3_bridge.esc @@ -17,6 +17,11 @@ teleport player r3_r_exit # Set player look left set_angle player 270 + + # If bridge not closed + > [!r3_bridge_closed] + set_interactive r3_right_platform false + stop > [!last_scene] teleport player player_start diff --git a/game/rooms/room3/room3.tscn b/game/rooms/room3/room3.tscn index cfc0bd63..d1d11109 100644 --- a/game/rooms/room3/room3.tscn +++ b/game/rooms/room3/room3.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://game/rooms/room3/walkable_area.tscn" type="PackedScene" id=1] [ext_resource path="res://game/rooms/room3/background.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=3] +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=3] [ext_resource path="res://game/characters/mark/mark.tscn" type="PackedScene" id=4] +[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=5] [ext_resource path="res://addons/escoria-core/game/core-scripts/escroom.gd" type="Script" id=6] [node name="room3" type="Node2D"] @@ -11,27 +12,27 @@ script = ExtResource( 6 ) global_id = "room3" esc_script = "res://game/rooms/room3/esc/room3_bridge.esc" player_scene = ExtResource( 4 ) +camera_limits = [ Rect2( 0, 0, 1289, 555 ) ] [node name="background" parent="." instance=ExtResource( 2 )] +[node name="room_label" type="Label" parent="background"] +margin_right = 40.0 +margin_bottom = 14.0 +custom_fonts/font = ExtResource( 3 ) +text = "ROOM 3" + [node name="walkable_area" parent="." instance=ExtResource( 1 )] [node name="Hotspots" type="Node2D" parent="."] [node name="r_platform" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) +script = ExtResource( 5 ) __meta__ = { "_editor_description_": "" } global_id = "r3_right_platform" -is_exit = false esc_script = "res://game/rooms/room3/esc/right_platform.esc" -is_interactive = true -player_orients_on_arrival = true -interaction_direction = 0 -tooltip_name = "Right platform" -default_action = "" -combine_if_action_used_among = PoolStringArray( ) dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 430.893, 451.052 ) @@ -50,16 +51,14 @@ __meta__ = { } [node name="r_door" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) +script = ExtResource( 5 ) +__meta__ = { +"_editor_description_": "" +} global_id = "r3_r_exit" -is_exit = true esc_script = "res://game/rooms/room3/esc/right_exit.esc" -is_interactive = true -player_orients_on_arrival = true -interaction_direction = 0 +is_exit = true tooltip_name = "Exit" -default_action = "" -combine_if_action_used_among = PoolStringArray( ) dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 1225.47, 353.99 ) @@ -72,16 +71,14 @@ polygon = PoolVector2Array( 1177.94, 348.61, 1175.95, 45.3759, 1276.06, 92.0953, position = Vector2( 1225.47, 353.99 ) [node name="l_door" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) +script = ExtResource( 5 ) +__meta__ = { +"_editor_description_": "" +} global_id = "r3_l_exit" -is_exit = true esc_script = "res://game/rooms/room3/esc/left_exit.esc" -is_interactive = true -player_orients_on_arrival = true -interaction_direction = 0 +is_exit = true tooltip_name = "Exit" -default_action = "" -combine_if_action_used_among = PoolStringArray( ) dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 44.1375, 384.691 ) diff --git a/game/rooms/room4/room4.tscn b/game/rooms/room4/room4.tscn index e7badf09..ec113183 100644 --- a/game/rooms/room4/room4.tscn +++ b/game/rooms/room4/room4.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=9 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://addons/escoria-core/game/core-scripts/escterrain.gd" type="Script" id=1] [ext_resource path="res://addons/escoria-core/game/core-scripts/escbackground.gd" type="Script" id=2] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=3] +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=3] [ext_resource path="res://game/characters/mark/mark.tscn" type="PackedScene" id=4] +[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=5] [ext_resource path="res://addons/escoria-core/game/core-scripts/escroom.gd" type="Script" id=6] [ext_resource path="res://game/rooms/room4/assets/background.png" type="Texture" id=7] [ext_resource path="res://game/rooms/room4/assets/depth_reduced.png" type="Texture" id=8] @@ -19,7 +20,6 @@ global_id = "room4" esc_script = "res://game/rooms/room4/esc/room4.esc" player_scene = ExtResource( 4 ) camera_limits = [ Rect2( 0, 0, 1666, 574 ) ] -editor_debug_mode = 1 [node name="background" type="TextureRect" parent="."] margin_right = 1666.0 @@ -49,6 +49,12 @@ points = PoolVector2Array( 2252.91, 610.733, 2251.32, 332.938, 2384.66, 386.909, visible = false points = PoolVector2Array( 6.10242, 307.886, 2.0979, 129.017, 84.858, 129.017, 84.858, 311.89, 4.76758, 307.886 ) +[node name="room_label" type="Label" parent="background"] +margin_right = 40.0 +margin_bottom = 14.0 +custom_fonts/font = ExtResource( 3 ) +text = "ROOM 4" + [node name="walkable_area" type="Navigation2D" parent="."] script = ExtResource( 1 ) scales = ExtResource( 8 ) @@ -64,16 +70,15 @@ __meta__ = { } [node name="player_start" type="Position2D" parent="."] -position = Vector2( 1506.21, 410.473 ) +position = Vector2( 82.9282, 347.615 ) [node name="Hotspots" type="Node2D" parent="."] [node name="l_door" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) +script = ExtResource( 5 ) global_id = "l_exit" -is_exit = true esc_script = "res://game/rooms/room4/esc/left_exit.esc" -tooltip_name = "Exit" +is_exit = true dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 83.6298, 279.703 ) @@ -86,11 +91,10 @@ polygon = PoolVector2Array( 29.1046, 292.156, 31.0151, 76.8949, 147.177, 74.4792 position = Vector2( 83.6298, 279.703 ) [node name="r_door" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) +script = ExtResource( 5 ) global_id = "r_exit" -is_exit = true esc_script = "res://game/rooms/room4/esc/right_exit.esc" -tooltip_name = "Exit" +is_exit = true dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 1611.46, 301.017 ) diff --git a/game/rooms/room5/esc/room5.esc b/game/rooms/room5/esc/room5.esc index 94b1a23b..b0ac1f28 100755 --- a/game/rooms/room5/esc/room5.esc +++ b/game/rooms/room5/esc/room5.esc @@ -11,6 +11,7 @@ stop > [!last_scene] teleport player player_start + set_angle player 90 stop :ready diff --git a/game/rooms/room5/esc/wall_item.esc b/game/rooms/room5/esc/wall_item.esc index 9a154ae7..d68e48b3 100755 --- a/game/rooms/room5/esc/wall_item.esc +++ b/game/rooms/room5/esc/wall_item.esc @@ -9,6 +9,15 @@ stop > [eq dialog_advance 2] say player "No, SERIOUSLY, I have no idea what that is!" + set_angle player 180 say player "Please stop asking me that!" stop + +:use r5_wrench +> [r5_wall_item_state_round] + set_state r5_wall_item state_square + set_global r5_wall_item_state_round false + stop +set_state r5_wall_item state_round +set_global r5_wall_item_state_round true diff --git a/game/rooms/room5/item_wall/item_wall.tscn b/game/rooms/room5/item_wall/item_wall.tscn new file mode 100644 index 00000000..4b0a2de9 --- /dev/null +++ b/game/rooms/room5/item_wall/item_wall.tscn @@ -0,0 +1,85 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=1] + +[sub_resource type="Animation" id=1] +resource_name = "state_round" +tracks/0/type = "value" +tracks/0/path = NodePath("square: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("round: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": [ true ] +} + +[sub_resource type="Animation" id=2] +resource_name = "state_square" +tracks/0/type = "value" +tracks/0/path = NodePath("square: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": [ true ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("round: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 ] +} + +[node name="item_wall" type="Area2D"] +script = ExtResource( 1 ) +dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 0, 0 ) +} + +[node name="square" type="Line2D" parent="."] +points = PoolVector2Array( 531, 527.828, 532, 483.828, 532.586, 445.745, 533.262, 401.771, 534, 353.828, 575.992, 355.093, 617.954, 356.357, 660.945, 357.652, 700, 358.828, 700.786, 402.832, 701.536, 444.836, 702.286, 486.841, 703, 526.828, 659.007, 526.574, 619.997, 526.348, 574.998, 526.088, 530, 525.828 ) +__meta__ = { +"_editor_description_": "" +} + +[node name="round" type="Line2D" parent="."] +visible = false +points = PoolVector2Array( 559.845, 508.706, 537.622, 482.513, 532.586, 445.745, 537.622, 414.255, 551.908, 384.095, 578.101, 366.633, 617.954, 356.357, 659.058, 363.458, 677.313, 375.364, 692.393, 399.175, 701.918, 441.241, 694.774, 484.101, 677.313, 504.737, 652.708, 518.23, 622.548, 526.167, 586.038, 518.23, 558.258, 506.324 ) +__meta__ = { +"_editor_description_": "" +} + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +position = Vector2( 0, 265.2 ) +polygon = PoolVector2Array( 528, 85, 529, 264, 708, 263, 706, 85 ) + +[node name="animation" type="AnimationPlayer" parent="."] +anims/state_round = SubResource( 1 ) +anims/state_square = SubResource( 2 ) diff --git a/game/rooms/room5/room5.tscn b/game/rooms/room5/room5.tscn index 2345028d..2e1e8fca 100644 --- a/game/rooms/room5/room5.tscn +++ b/game/rooms/room5/room5.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=13 format=2] +[gd_scene load_steps=12 format=2] [ext_resource path="res://addons/escoria-core/game/core-scripts/escterrain.gd" type="Script" id=1] [ext_resource path="res://game/rooms/room5/background.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=3] +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=3] [ext_resource path="res://game/characters/mark/mark.tscn" type="PackedScene" id=4] +[ext_resource path="res://game/rooms/room5/item_wall/item_wall.tscn" type="PackedScene" id=5] [ext_resource path="res://addons/escoria-core/game/core-scripts/escroom.gd" type="Script" id=6] [ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=7] [ext_resource path="res://game/items/escitems/wrench_escitem.tscn" type="PackedScene" id=8] @@ -15,36 +16,6 @@ vertices = PoolVector2Array( 1168.92, 640.557, 1182.53, 588.863, 1269.59, 622.87 polygons = [ PoolIntArray( 0, 1, 2, 3 ), PoolIntArray( 4, 5, 0, 3, 6, 7 ), PoolIntArray( 7, 6, 8, 9, 10 ) ] outlines = [ PoolVector2Array( -6.44019, 711.297, 3.15687, 646.051, 59.2201, 628.698, 84.5821, 654.06, 129.634, 615.792, 1143.08, 613.35, 1168.92, 640.557, 1182.53, 588.863, 1269.59, 622.872, 1275.03, 799.721, -9.16094, 803.802 ) ] -[sub_resource type="Animation" id=2] -resource_name = "state_round" -tracks/0/type = "value" -tracks/0/path = NodePath("Line2D:points") -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": [ PoolVector2Array( 556, 496.828, 543, 476.828, 532, 438.828, 543, 411.828, 560, 384.828, 590, 363.828, 617, 357.828, 655, 367.828, 684, 386.828, 695, 411.828, 701.536, 444.836, 698, 481.828, 683, 499.828, 658, 515.828, 619.997, 526.348, 584, 515.828, 558, 497.828 ) ] -} - -[sub_resource type="Animation" id=3] -resource_name = "state_square" -tracks/0/type = "value" -tracks/0/path = NodePath("Line2D:points") -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": [ PoolVector2Array( 531, 527.828, 532, 483.828, 532.586, 445.745, 533.262, 401.771, 534, 353.828, 575.992, 355.093, 617.954, 356.357, 660.945, 357.652, 700, 358.828, 700.786, 402.832, 701.536, 444.836, 702.286, 486.841, 703, 526.828, 659.007, 526.574, 619.997, 526.348, 574.998, 526.088, 530, 525.828 ) ] -} - [node name="room5" type="Node2D"] script = ExtResource( 6 ) __meta__ = { @@ -53,6 +24,7 @@ __meta__ = { global_id = "room5" esc_script = "res://game/rooms/room5/esc/room5.esc" player_scene = ExtResource( 4 ) +camera_limits = [ Rect2( 0, 0, 1289, 555 ) ] [node name="background" parent="." instance=ExtResource( 2 )] @@ -64,6 +36,7 @@ margin_left = 142.828 margin_top = 492.556 margin_right = 366.828 margin_bottom = 506.556 +custom_fonts/font = ExtResource( 3 ) text = "Pickup & use on background object" __meta__ = { "_edit_use_anchors_": false @@ -78,12 +51,30 @@ margin_left = 142.828 margin_top = 492.556 margin_right = 366.828 margin_bottom = 506.556 +custom_fonts/font = ExtResource( 3 ) text = "Pickup & combine together in enventory Note: you can combine in both directions" __meta__ = { "_edit_use_anchors_": false } +[node name="Label" type="Label" parent="background"] +margin_left = 297.669 +margin_top = 137.488 +margin_right = 514.669 +margin_bottom = 151.488 +custom_fonts/font = ExtResource( 3 ) +text = "Look at this object multiple times" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="room_label" type="Label" parent="background"] +margin_right = 62.0 +margin_bottom = 16.0 +custom_fonts/font = ExtResource( 3 ) +text = "ROOM 5" + [node name="walkable_area" type="Navigation2D" parent="."] script = ExtResource( 1 ) @@ -97,16 +88,11 @@ __meta__ = { [node name="Hotspots" type="Node2D" parent="."] [node name="l_door" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) +script = ExtResource( 7 ) global_id = "r5_l_exit" -is_exit = true esc_script = "res://game/rooms/room5/esc/left_exit.esc" -is_interactive = true -player_orients_on_arrival = true -interaction_direction = 0 -tooltip_name = "Exit" -default_action = "" -combine_if_action_used_among = PoolStringArray( ) +is_exit = true +tooltip_name = "Left exit" dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 37.4521, 392.045 ) @@ -120,16 +106,11 @@ position = Vector2( 37.4521, 392.045 ) [node name="r_door" type="Area2D" parent="Hotspots"] position = Vector2( -1, 0 ) -script = ExtResource( 3 ) +script = ExtResource( 7 ) global_id = "r5_r_exit" -is_exit = true esc_script = "res://game/rooms/room5/esc/right_exit.esc" -is_interactive = true -player_orients_on_arrival = true -interaction_direction = 0 -tooltip_name = "Exit" -default_action = "" -combine_if_action_used_among = PoolStringArray( ) +is_exit = true +tooltip_name = "Right exit" dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 1224.47, 353.99 ) @@ -141,42 +122,43 @@ polygon = PoolVector2Array( 1177.94, 348.61, 1175.95, 45.3759, 1276.06, 92.0953, [node name="Position2D" type="Position2D" parent="Hotspots/r_door"] position = Vector2( 1225.47, 353.99 ) -[node name="item_wall" type="Sprite" parent="Hotspots"] -script = ExtResource( 7 ) +[node name="item_wall" parent="Hotspots" instance=ExtResource( 5 )] +position = Vector2( 2.37842, -254.49 ) global_id = "r5_wall_item" esc_script = "res://game/rooms/room5/esc/wall_item.esc" tooltip_name = "Item on the wall" default_action = "look" -combine_if_action_used_among = PoolStringArray( "use" ) -dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 657, 377 ) +} -[node name="Line2D" type="Line2D" parent="Hotspots/item_wall"] -position = Vector2( 0, -267.828 ) -points = PoolVector2Array( 531, 527.828, 532, 483.828, 532.586, 445.745, 533.262, 401.771, 534, 353.828, 575.992, 355.093, 617.954, 356.357, 660.945, 357.652, 700, 358.828, 700.786, 402.832, 701.536, 444.836, 702.286, 486.841, 703, 526.828, 659.007, 526.574, 619.997, 526.348, 574.998, 526.088, 530, 525.828 ) +[node name="Position2D2" type="Position2D" parent="Hotspots/item_wall"] +position = Vector2( 620.135, 613.652 ) __meta__ = { "_editor_description_": "" } -[node name="Area2D" type="Area2D" parent="Hotspots/item_wall"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/item_wall/Area2D"] -polygon = PoolVector2Array( 528, 85, 529, 264, 708, 263, 706, 85 ) - -[node name="Position2D" type="Position2D" parent="Hotspots/item_wall"] -position = Vector2( 657, 377 ) - -[node name="animation" type="AnimationPlayer" parent="Hotspots/item_wall"] -anims/state_round = SubResource( 2 ) -anims/state_square = SubResource( 3 ) - [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 ) +interact_positions = { +"default": Vector2( 1059.84, 440.932 ) +} [node name="player_start" type="Position2D" parent="."] position = Vector2( 76.7617, 437.649 ) diff --git a/game/rooms/room6/esc/room6.esc b/game/rooms/room6/esc/room6.esc index e4c8d3e7..753558d0 100755 --- a/game/rooms/room6/esc/room6.esc +++ b/game/rooms/room6/esc/room6.esc @@ -18,5 +18,4 @@ #set_active r5_pen false #set_global i/r5_empty_sheet true #set_active r5_empty_sheet false - inventory_add r5_filled_sheet diff --git a/game/rooms/room6/esc/worker.esc b/game/rooms/room6/esc/worker.esc index da281af4..b0d787a2 100755 --- a/game/rooms/room6/esc/worker.esc +++ b/game/rooms/room6/esc/worker.esc @@ -32,3 +32,21 @@ say player "I don't think he'd like that." stop +:use r5_filled_sheet +say player "I'll give you this!" + +:give r5_filled_sheet +inventory_remove r5_filled_sheet + +say worker "Hey! That's perfect!" +say worker "I can finally get away from here!" +walk_to_pos worker 1200 400 +#set_angle worker 45 + +# Open the door +set_state r6_door r_door_open +set_global r6_door_open true + +# Disappear! +wait 1 +set_active worker false diff --git a/game/rooms/room6/l_exit.tscn b/game/rooms/room6/l_exit.tscn new file mode 100644 index 00000000..0852f690 --- /dev/null +++ b/game/rooms/room6/l_exit.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=1] + +[node name="l_exit" type="Area2D"] +script = ExtResource( 1 ) +global_id = "r6_l_exit" +esc_script = "res://game/rooms/room6/esc/left_exit.esc" +is_exit = true +tooltip_name = "Left exit" +dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 0, 0 ) +} + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PoolVector2Array( 0.328762, 440.897, 1.85199, 119.926, 85.9517, 74.6212, 87.1409, 377.869 ) diff --git a/game/rooms/room6/r_door.tscn b/game/rooms/room6/r_door.tscn new file mode 100644 index 00000000..02c47156 --- /dev/null +++ b/game/rooms/room6/r_door.tscn @@ -0,0 +1,117 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=1] + +[sub_resource type="Animation" id=1] +resource_name = "r_door_close" +tracks/0/type = "value" +tracks/0/path = NodePath("r_door_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": [ true ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("r_door_opened: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(".:is_exit") +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": [ false ] +} + +[sub_resource type="Animation" id=2] +resource_name = "r_door_open" +length = 0.3 +tracks/0/type = "value" +tracks/0/path = NodePath("r_door_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("r_door_opened: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": [ true ] +} +tracks/2/type = "value" +tracks/2/path = NodePath(".:is_exit") +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 ] +} + +[node name="r_door" type="Area2D"] +script = ExtResource( 1 ) +global_id = "r6_door" +esc_script = "res://game/rooms/room6/esc/r6_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 ) +polygon = PoolVector2Array( 1172.3, 44.8186, 1172.3, 348.012, 1273.9, 401.983, 1277.07, 89.2657 ) + +[node name="Line2D" type="Line2D" parent="r_door_closed"] +points = PoolVector2Array( 1265.23, 266.8, 1253.65, 276.6, 1252.76, 230.273, 1264.34, 233.837 ) +default_color = Color( 1, 1, 1, 1 ) + +[node name="r_door_opened" type="Polygon2D" parent="."] +visible = false +color = Color( 0.482353, 0.568627, 1, 1 ) +polygon = PoolVector2Array( 1172.3, 44.8186, 1172.3, 348.012, 1029.82, 349.887, 1025.19, 42.1269 ) + +[node name="Line2D" type="Line2D" parent="r_door_opened"] +points = PoolVector2Array( 1048.98, 230.477, 1048.98, 189.89 ) +default_color = Color( 1, 1, 1, 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +anims/r_door_close = SubResource( 1 ) +anims/r_door_open = SubResource( 2 ) + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PoolVector2Array( 1169.35, 41.7644, 1168.09, 347.925, 1275.18, 407.141, 1278.96, 88.3814 ) diff --git a/game/rooms/room6/room6.tscn b/game/rooms/room6/room6.tscn index d432d058..f69de3c2 100644 --- a/game/rooms/room6/room6.tscn +++ b/game/rooms/room6/room6.tscn @@ -1,97 +1,19 @@ -[gd_scene load_steps=11 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://addons/escoria-core/game/core-scripts/escterrain.gd" type="Script" id=1] [ext_resource path="res://game/rooms/room6/background.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=3] +[ext_resource path="res://game/rooms/room6/l_exit.tscn" type="PackedScene" id=3] [ext_resource path="res://game/characters/mark/mark.tscn" type="PackedScene" id=4] -[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=5] +[ext_resource path="res://game/rooms/room6/r_door.tscn" type="PackedScene" id=5] [ext_resource path="res://addons/escoria-core/game/core-scripts/escroom.gd" type="Script" id=6] [ext_resource path="res://game/characters/worker/worker.tscn" type="PackedScene" id=7] +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=8] [sub_resource type="NavigationPolygon" id=1] vertices = PoolVector2Array( 1168.92, 640.557, 1182.53, 588.863, 1269.59, 622.872, 1275.03, 799.721, 129.634, 615.792, 1143.08, 613.35, -9.16094, 803.802, 84.5821, 654.06, -6.44019, 711.297, 3.15687, 646.051, 59.2201, 628.698 ) polygons = [ PoolIntArray( 0, 1, 2, 3 ), PoolIntArray( 4, 5, 0, 3, 6, 7 ), PoolIntArray( 7, 6, 8, 9, 10 ) ] outlines = [ PoolVector2Array( -6.44019, 711.297, 3.15687, 646.051, 59.2201, 628.698, 84.5821, 654.06, 129.634, 615.792, 1143.08, 613.35, 1168.92, 640.557, 1182.53, 588.863, 1269.59, 622.872, 1275.03, 799.721, -9.16094, 803.802 ) ] -[sub_resource type="Animation" id=2] -resource_name = "r_door_close" -tracks/0/type = "value" -tracks/0/path = NodePath("r_door_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": [ true ] -} -tracks/1/type = "value" -tracks/1/path = NodePath("r_door_opened: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(".:is_exit") -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": [ false ] -} - -[sub_resource type="Animation" id=3] -resource_name = "r_door_open" -length = 0.3 -tracks/0/type = "value" -tracks/0/path = NodePath("r_door_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("r_door_opened: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": [ true ] -} -tracks/2/type = "value" -tracks/2/path = NodePath(".:is_exit") -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 ] -} - [node name="room6" type="Node2D"] script = ExtResource( 6 ) __meta__ = { @@ -104,6 +26,24 @@ camera_limits = [ Rect2( 0, 0, 1289, 555 ) ] [node name="background" parent="." instance=ExtResource( 2 )] +[node name="room_label" type="Label" parent="background"] +margin_right = 40.0 +margin_bottom = 14.0 +custom_fonts/font = ExtResource( 8 ) +text = "ROOM 6" + +[node name="Label" type="Label" parent="background"] +margin_left = 539.39 +margin_top = 173.804 +margin_right = 600.39 +margin_bottom = 189.804 +custom_fonts/font = ExtResource( 8 ) +text = "Talk to me" + +[node name="Line2D" type="Line2D" parent="background"] +points = PoolVector2Array( 570.36, 195.207, 570.832, 227.298, 541.1, 226.826, 547.579, 219.691, 547.933, 233.834, 541.569, 228.177 ) +width = 4.0 + [node name="walkable_area" type="Navigation2D" parent="."] script = ExtResource( 1 ) @@ -116,69 +56,37 @@ __meta__ = { [node name="Hotspots" type="Node2D" parent="."] -[node name="l_exit" type="Area2D" parent="Hotspots"] -script = ExtResource( 3 ) -global_id = "r6_l_exit" -is_exit = true -esc_script = "res://game/rooms/room6/esc/left_exit.esc" -tooltip_name = "Exit" -dialog_color = Color( 1, 1, 1, 1 ) +[node name="l_exit" parent="Hotspots" instance=ExtResource( 3 )] interact_positions = { "default": Vector2( 37.4521, 392.045 ) } -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/l_exit"] -polygon = PoolVector2Array( 0.328762, 440.897, 1.85199, 119.926, 85.9517, 74.6212, 87.1409, 377.869 ) - [node name="Position2D" type="Position2D" parent="Hotspots/l_exit"] position = Vector2( 37.4521, 392.045 ) +__meta__ = { +"_editor_description_": "" +} -[node name="r_door" type="Sprite" parent="Hotspots"] -script = ExtResource( 5 ) -global_id = "r6_door" -esc_script = "res://game/rooms/room6/esc/r6_door.esc" -interaction_direction = 1 -tooltip_name = "Door" -default_action = "open" -dialog_color = Color( 1, 1, 1, 1 ) - -[node name="r_door_closed" type="Polygon2D" parent="Hotspots/r_door"] -color = Color( 0.482353, 0.568627, 1, 1 ) -polygon = PoolVector2Array( 1172.3, 44.8186, 1172.3, 348.012, 1273.9, 401.983, 1277.07, 89.2657 ) - -[node name="Line2D" type="Line2D" parent="Hotspots/r_door/r_door_closed"] -points = PoolVector2Array( 1265.23, 266.8, 1253.65, 276.6, 1252.76, 230.273, 1264.34, 233.837 ) -default_color = Color( 1, 1, 1, 1 ) - -[node name="r_door_opened" type="Polygon2D" parent="Hotspots/r_door"] -visible = false -color = Color( 0.482353, 0.568627, 1, 1 ) -polygon = PoolVector2Array( 1172.3, 44.8186, 1172.3, 348.012, 1029.82, 349.887, 1025.19, 42.1269 ) - -[node name="Line2D" type="Line2D" parent="Hotspots/r_door/r_door_opened"] -points = PoolVector2Array( 1048.98, 230.477, 1048.98, 189.89 ) -default_color = Color( 1, 1, 1, 1 ) - -[node name="AnimationPlayer" type="AnimationPlayer" parent="Hotspots/r_door"] -anims/r_door_close = SubResource( 2 ) -anims/r_door_open = SubResource( 3 ) +[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 ) - -[node name="Area2D" type="Area2D" parent="Hotspots/r_door"] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/r_door/Area2D"] -polygon = PoolVector2Array( 1169.35, 41.7644, 1168.09, 347.925, 1275.18, 407.141, 1278.96, 88.3814 ) +__meta__ = { +"_editor_description_": "" +} [node name="worker" parent="Hotspots" instance=ExtResource( 7 )] -position = Vector2( 477.701, 421.582 ) +position = Vector2( 480, 430 ) +interaction_direction = 2 interact_positions = { -"default": Vector2( 349.904, 430.659 ) +"default": Vector2( 322.472, 428.374 ) } [node name="Position2D2" type="Position2D" parent="Hotspots/worker"] -position = Vector2( -138.501, 28.1043 ) +position = Vector2( -157.528, -1.62589 ) [node name="player_start" type="Position2D" parent="."] position = Vector2( 76.7617, 437.649 ) diff --git a/game/rooms/room7/room7.tscn b/game/rooms/room7/room7.tscn index 0a5c157d..bb9f889f 100644 --- a/game/rooms/room7/room7.tscn +++ b/game/rooms/room7/room7.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://addons/escoria-core/game/core-scripts/escterrain.gd" type="Script" id=1] [ext_resource path="res://game/rooms/room7/background.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/escoria-core/game/core-scripts/eschotspot.gd" type="Script" id=3] [ext_resource path="res://game/characters/mark/mark.tscn" type="PackedScene" id=4] +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=5] [ext_resource path="res://addons/escoria-core/game/core-scripts/escroom.gd" type="Script" id=6] +[ext_resource path="res://addons/escoria-core/game/core-scripts/escitem.gd" type="Script" id=7] [sub_resource type="NavigationPolygon" id=1] vertices = PoolVector2Array( 1976.63, 640.557, 1987.95, 588.863, 2070.07, 622.872, 2066.3, 799.721, 1015.72, 626.818, 1956.81, 616.096, -9.16094, 803.802, -6.44019, 711.297, 911.239, 554.152, 991.239, 554.152, 858.566, 628.405, 741.099, 620.468, 84.5821, 654.06, 3.15687, 646.051, 59.2201, 628.698, 129.634, 615.792 ) @@ -31,6 +32,19 @@ editor_debug_mode = 1 margin_right = 2098.0 margin_bottom = 1961.0 +[node name="room_label_1" type="Label" parent="background"] +margin_right = 40.0 +margin_bottom = 14.0 +custom_fonts/font = ExtResource( 5 ) +text = "ROOM 7 - upstairs" + +[node name="room_label_2" type="Label" parent="background"] +margin_top = 1354.53 +margin_right = 136.0 +margin_bottom = 1368.53 +custom_fonts/font = ExtResource( 5 ) +text = "ROOM 7 - downstairs" + [node name="walkable_area" type="Navigation2D" parent="."] script = ExtResource( 1 ) @@ -50,10 +64,13 @@ enabled = false [node name="l_exit" type="Area2D" parent="Hotspots"] position = Vector2( 0, 1409.59 ) -script = ExtResource( 3 ) +script = ExtResource( 7 ) +__meta__ = { +"_editor_description_": "" +} global_id = "r7_l_exit" -is_exit = true esc_script = "res://game/rooms/room7/esc/left_exit.esc" +is_exit = true tooltip_name = "Exit" dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { @@ -68,10 +85,13 @@ position = Vector2( 37.4521, 392.045 ) [node name="r_exit" type="Area2D" parent="Hotspots"] position = Vector2( 0, 1409.59 ) -script = ExtResource( 3 ) +script = ExtResource( 7 ) +__meta__ = { +"_editor_description_": "" +} global_id = "r7_r_exit" -is_exit = true esc_script = "res://game/rooms/room7/esc/right_exit.esc" +is_exit = true is_interactive = false interaction_direction = 1 tooltip_name = "Exit" @@ -93,7 +113,10 @@ __meta__ = { [node name="object2" type="Area2D" parent="Hotspots"] position = Vector2( 1600.63, 1358.99 ) -script = ExtResource( 3 ) +script = ExtResource( 7 ) +__meta__ = { +"_editor_description_": "" +} global_id = "r7_object2" dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { @@ -108,10 +131,13 @@ points = PoolVector2Array( -74.0056, 70.7457, 2.32182, 28.0921, 89.8739, 77.4804 [node name="lower_stairs" type="Area2D" parent="Hotspots"] position = Vector2( 0, 1409.59 ) -script = ExtResource( 3 ) +script = ExtResource( 7 ) +__meta__ = { +"_editor_description_": "" +} global_id = "r7_lower_stairs" -is_exit = true esc_script = "res://game/rooms/room7/esc/lower_stairs.esc" +is_exit = true dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { "default": Vector2( 953.985, 1725.12 ) @@ -125,14 +151,11 @@ position = Vector2( 953.985, 315.526 ) [node name="upper_stairs" type="Area2D" parent="Hotspots"] position = Vector2( 1347.64, 473.026 ) -script = ExtResource( 3 ) +script = ExtResource( 7 ) global_id = "r7_upper_stairs" -is_exit = true esc_script = "res://game/rooms/room7/esc/upper_stairs.esc" -dialog_color = Color( 1, 1, 1, 1 ) -interact_positions = { -"default": Vector2( 1375.17, 604.793 ) -} +is_exit = true +tooltip_name = "Stairs" [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/upper_stairs"] position = Vector2( -1334.92, 936.565 ) diff --git a/game/ui/commons/fonts/caslonantique.tres b/game/ui/commons/fonts/caslonantique.tres new file mode 100644 index 00000000..9c26f12d --- /dev/null +++ b/game/ui/commons/fonts/caslonantique.tres @@ -0,0 +1,6 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://addons/escoria-core/game/assets/fonts/efmi/efmi.TTF" type="DynamicFontData" id=1] + +[resource] +font_data = ExtResource( 1 ) diff --git a/game/ui/ui_9verbs/game.gd b/game/ui/ui_9verbs/game.gd index 82217610..98d38c3b 100644 --- a/game/ui/ui_9verbs/game.gd +++ b/game/ui/ui_9verbs/game.gd @@ -10,10 +10,6 @@ Implement methods to react to inputs. - element_focused(element_id : String) - element_unfocused() -- left_click_on_hotspot(hotspot_global_id : String, event : InputEvent) -- right_click_on_hotspot(hotspot_global_id : String, event : InputEvent) -- left_double_click_on_hotspot(hotspot_global_id : String, event : InputEvent) - - left_click_on_item(item_global_id : String, event : InputEvent) - right_click_on_item(item_global_id : String, event : InputEvent) - left_double_click_on_item(item_global_id : String, event : InputEvent) @@ -61,18 +57,6 @@ func element_unfocused() -> void: pass -## HOTSPOTS ## - -func left_click_on_hotspot(hotspot_global_id : String, event : InputEvent) -> void: - escoria.do("hotspot_left_click", [hotspot_global_id, event]) - -func right_click_on_hotspot(hotspot_global_id : String, event : InputEvent) -> void: - escoria.do("hotspot_right_click", [hotspot_global_id, event]) - -func left_double_click_on_hotspot(hotspot_global_id : String, event : InputEvent) -> void: - escoria.do("hotspot_left_click", [hotspot_global_id, event]) - - ## ITEMS ## func left_click_on_item(item_global_id : String, event : InputEvent) -> void: diff --git a/game/ui/ui_mouse_icons/game.gd b/game/ui/ui_mouse_icons/game.gd index 22ac26a3..e8794146 100644 --- a/game/ui/ui_mouse_icons/game.gd +++ b/game/ui/ui_mouse_icons/game.gd @@ -56,18 +56,6 @@ func element_unfocused() -> void: pass -## HOTSPOTS ## - -func left_click_on_hotspot(hotspot_global_id : String, event : InputEvent) -> void: - escoria.do("hotspot_left_click", [hotspot_global_id, event]) - -func right_click_on_hotspot(hotspot_global_id : String, event : InputEvent) -> void: - escoria.do("hotspot_right_click", [hotspot_global_id, event]) - -func left_double_click_on_hotspot(hotspot_global_id : String, event : InputEvent) -> void: - escoria.do("hotspot_left_click", [hotspot_global_id, event]) - - ## ITEMS ## func left_click_on_item(item_global_id : String, event : InputEvent) -> void: diff --git a/project.godot b/project.godot index 3bcc99f3..659ce9ad 100644 --- a/project.godot +++ b/project.godot @@ -29,11 +29,6 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://addons/escoria-core/game/scenes/dialogs/dialog_player.gd" }, { -"base": "Area2D", -"class": "ESCHotspot", -"language": "GDScript", -"path": "res://addons/escoria-core/game/core-scripts/eschotspot.gd" -}, { "base": "Control", "class": "ESCInventory", "language": "GDScript", @@ -44,7 +39,7 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://addons/escoria-core/game/core-scripts/inventory_item.gd" }, { -"base": "Sprite", +"base": "Area2D", "class": "ESCItem", "language": "GDScript", "path": "res://addons/escoria-core/game/core-scripts/escitem.gd" @@ -68,20 +63,25 @@ _global_script_classes=[ { "class": "ESCTriggerZone", "language": "GDScript", "path": "res://addons/escoria-core/game/core-scripts/esctriggerzone.gd" +}, { +"base": "Node", +"class": "Movable", +"language": "GDScript", +"path": "res://addons/escoria-core/game/core-scripts/behaviors/movable.gd" } ] _global_script_class_icons={ "ESCBackground": "", "ESCCamera": "", "ESCCharacter": "", "ESCDialogsPlayer": "", -"ESCHotspot": "", "ESCInventory": "", "ESCInventoryItem": "", "ESCItem": "", "ESCPlayer": "", "ESCRoom": "", "ESCTerrain": "", -"ESCTriggerZone": "" +"ESCTriggerZone": "", +"Movable": "" } [application]