diff --git a/addons/escoria-core/game/core-scripts/behaviors/movable.gd b/addons/escoria-core/game/core-scripts/behaviors/movable.gd index 731d09a5..0c0c8456 100644 --- a/addons/escoria-core/game/core-scripts/behaviors/movable.gd +++ b/addons/escoria-core/game/core-scripts/behaviors/movable.gd @@ -182,6 +182,8 @@ func walk_stop(pos): # escoria.esc_level_runner.finished(walk_context) escoria.esc_level_runner.finished() parent.walk_context = null + + yield(parent.animation_sprite, "animation_finished") parent.emit_signal("arrived") diff --git a/addons/escoria-core/game/core-scripts/esc/esc_compiler.gd b/addons/escoria-core/game/core-scripts/esc/esc_compiler.gd index e0e032c1..157ef498 100644 --- a/addons/escoria-core/game/core-scripts/esc/esc_compiler.gd +++ b/addons/escoria-core/game/core-scripts/esc/esc_compiler.gd @@ -69,6 +69,7 @@ var commands = { "slide_block": { "min_args": 2 }, "spawn": { "min_args": 1 }, "stop": true, + "superpose_scene": { "min_args": 1, "types": [TYPE_STRING, TYPE_BOOL] }, "teleport": { "min_args": 2, "types": [TYPE_STRING, TYPE_STRING, TYPE_INT] }, "teleport_pos": { "min_args": 3 }, "turn_to": { "min_args": 2 }, diff --git a/addons/escoria-core/game/core-scripts/esc/esc_runner.gd b/addons/escoria-core/game/core-scripts/esc/esc_runner.gd index 4c9e210f..e3272a78 100644 --- a/addons/escoria-core/game/core-scripts/esc/esc_runner.gd +++ b/addons/escoria-core/game/core-scripts/esc/esc_runner.gd @@ -393,6 +393,68 @@ func change_scene(params, context, run_events=true): # cam_target = null # autosave_pending = true + +func superpose_scene(params, context, run_events=true): + printt("superposing scene ", params[0], " with run_events ", run_events) +# check_cache() +# main.clear_scene() +# camera = null +# event_queue = [] + + # Regular events need to be reset immediately, so we don't + # accidentally `yield()` on them, for performance reasons. + # This does not affect `stack` so execution is fine anyway. + if running_event and running_event.ev_name != "load": + emit_signal("event_done", running_event.ev_name) + running_event = null + + var res_room = resource_cache.get_resource(params[0]) + var res_game = resource_cache.get_resource(ProjectSettings.get_setting("escoria/ui/game_scene")) + if !res_room: + escoria.report_errors("esc_runner.gd:superpose_scene()", + ["Resource not found: " + params[0]]) + if !res_game: + escoria.report_errors("esc_runner.gd:superpose_scene()", + ["Resource not found: " + ProjectSettings.get_setting("escoria/ui/game_scene")]) + + resource_cache.clear() + + # Load game scene + var game_scene = res_game.instance() + if !game_scene: + escoria.report_errors("esc_runner.gd:superpose_scene()", + ["Failed loading scene " + ProjectSettings.get_setting("escoria/ui/game_scene")]) + + # Load room scene + var room_scene = res_room.instance() + if room_scene: + get_node("/root").add_child(room_scene) + + + escoria.inputs_manager.is_hotspot_focused = false + if !scenes_cache_list.has(params[0]): + scenes_cache_list.push_back(params[0]) + if room_scene.get("global_id"): + scenes_cache[room_scene.global_id] = params[0] + else: + scenes_cache[room_scene.name] = params[0] + else: + escoria.report_errors("esc_runner.gd:superpose_scene()", + ["Failed loading scene " + params[0]]) + + if context != null: + context.waiting = false + + # Re-apply actives + for active in actives: + set_active(active, actives[active]) + +# cam_target = null +# autosave_pending = true + + + + func run_game(actions : Dictionary): set_process(true) # `load` and `ready` are exclusive because you probably don't want to 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 90f37616..6e1f4036 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 @@ -543,6 +543,35 @@ func spawn(command_params : Array): func stop(command_params : Array): return esctypes.EVENT_LEVEL_STATE.BREAK + +""" +superpose_scene path [run_events] +Loads a new scene, specified by "path" and displays it OVER the current one. +This is useful to display puzzle scenes over the current room, so that you don't +loose any progression and continuity. +- path String Path to the scene to superpose. +- run_events Boolean (default true) which you never want to set +manually! It's there only to benefit save games, so they don't conflict with the +scene's events. +""" +func superpose_scene(command_params : Array): + # Savegames must have events disabled, so saving the game adds a false to params + var run_events = true + if command_params.size() == 2: + run_events = bool(command_params[1]) + + # looking for localized string format in scene. this should be somewhere else + var sep = command_params[0].find(":\"") + if sep >= 0: + var path = command_params[0].substr(sep + 2, command_params[0].length() - (sep + 2)) + escoria.esc_runner.call_deferred("superpose_scene", [path], current_context, run_events) + else: + escoria.esc_runner.call_deferred("superpose_scene", command_params, current_context, run_events) + + current_context.waiting = true + return esctypes.EVENT_LEVEL_STATE.YIELD + + """ Teleports obj1 at obj2's position. If angle_degrees is set (int), sets obj1's angle to angle_degrees. diff --git a/addons/escoria-core/game/core-scripts/escplayer.gd b/addons/escoria-core/game/core-scripts/escplayer.gd index e39d24b8..835ce378 100644 --- a/addons/escoria-core/game/core-scripts/escplayer.gd +++ b/addons/escoria-core/game/core-scripts/escplayer.gd @@ -148,98 +148,6 @@ func _process(time): if Engine.is_editor_hint(): 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 color: -## for s in sprites: -## s.set_modulate(color) """ diff --git a/game/rooms/room7/room7.tscn b/game/rooms/room7/room7.tscn index db9b468d..470f7b29 100644 --- a/game/rooms/room7/room7.tscn +++ b/game/rooms/room7/room7.tscn @@ -39,7 +39,7 @@ tracks/0/keys = { "values": [ Color( 0.0313726, 0.996078, 0, 1 ) ] } -[sub_resource type="Animation" id=9] +[sub_resource type="Animation" id=6] resource_name = "red" tracks/0/type = "value" tracks/0/path = NodePath("Polygon2D:color") @@ -69,7 +69,7 @@ tracks/0/keys = { "values": [ Color( 0.0313726, 0.996078, 0, 1 ) ] } -[sub_resource type="Animation" id=10] +[sub_resource type="Animation" id=8] resource_name = "red" tracks/0/type = "value" tracks/0/path = NodePath("Polygon2D:color") @@ -162,7 +162,6 @@ __meta__ = { global_id = "r7_r_exit" esc_script = "res://game/rooms/room7/esc/right_exit.esc" is_exit = true -is_interactive = false interaction_direction = 1 tooltip_name = "Exit" dialog_color = Color( 1, 1, 1, 1 ) @@ -207,7 +206,7 @@ __meta__ = { global_id = "r7_object2" dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { -"default": Vector2( 1600.63, 1358.99 ) +"default": Vector2( 1770.63, 1358.99 ) } [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/object2"] @@ -260,7 +259,7 @@ position = Vector2( -167.43, 1463.23 ) global_id = "r7_button_push" esc_script = "res://game/rooms/room7/esc/button_push.esc" interact_positions = { -"default": Vector2( 279.618, 1763.84 ) +"default": Vector2( 175.618, 1763.84 ) } [node name="Position2D" type="Position2D" parent="Hotspots/button_camera_push"] @@ -285,7 +284,7 @@ position = Vector2( 9.393, 1464.03 ) global_id = "r7_button_push" esc_script = "res://game/rooms/room7/esc/button_shift.esc" interact_positions = { -"default": Vector2( 463.651, 1765.65 ) +"default": Vector2( 359.651, 1765.65 ) } [node name="Position2D" type="Position2D" parent="Hotspots/button_camera_shift"] @@ -307,7 +306,7 @@ position = Vector2( 172.527, 1464.03 ) global_id = "r7_button_follow" esc_script = "res://game/rooms/room7/esc/button_follow.esc" interact_positions = { -"default": Vector2( 463.651, 1765.65 ) +"default": Vector2( 522.785, 1765.65 ) } [node name="Position2D" type="Position2D" parent="Hotspots/button_camera_follow"] @@ -329,7 +328,7 @@ position = Vector2( 332.527, 1464.03 ) global_id = "r7_button_zoom" esc_script = "res://game/rooms/room7/esc/button_zoom.esc" interact_positions = { -"default": Vector2( 522.785, 1765.65 ) +"default": Vector2( 682.785, 1765.65 ) } [node name="Position2D" type="Position2D" parent="Hotspots/button_camera_zoom"] @@ -356,7 +355,7 @@ is_interactive = false player_orients_on_arrival = false dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { -"default": null +"default": Vector2( 406, 0 ) } [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/trigger_left"] @@ -384,7 +383,7 @@ is_interactive = false player_orients_on_arrival = false dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { -"default": null +"default": Vector2( 592.68, 4.12805 ) } [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/trigger_right"] @@ -410,7 +409,7 @@ global_id = "r7_light_left" is_interactive = false dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { -"default": null +"default": Vector2( 1154.19, 1518.8 ) } [node name="Polygon2D" type="Polygon2D" parent="Hotspots/light_left"] @@ -423,7 +422,7 @@ shape = SubResource( 4 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="Hotspots/light_left"] anims/green = SubResource( 5 ) -anims/red = SubResource( 9 ) +anims/red = SubResource( 6 ) [node name="light_right" type="Area2D" parent="Hotspots"] position = Vector2( 613.333, -1.13 ) @@ -432,7 +431,7 @@ global_id = "r7_light_right" is_interactive = false dialog_color = Color( 1, 1, 1, 1 ) interact_positions = { -"default": Vector2( 742.194, 1518.8 ) +"default": Vector2( 1355.53, 1517.67 ) } [node name="Polygon2D" type="Polygon2D" parent="Hotspots/light_right"] @@ -445,7 +444,7 @@ shape = SubResource( 4 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="Hotspots/light_right"] anims/green = SubResource( 7 ) -anims/red = SubResource( 10 ) +anims/red = SubResource( 8 ) [node name="player_start" type="Position2D" parent="."] position = Vector2( 76.7617, 1847.24 ) diff --git a/game/rooms/room8/esc/button_puzzle.esc b/game/rooms/room8/esc/button_puzzle.esc new file mode 100755 index 00000000..3a518837 --- /dev/null +++ b/game/rooms/room8/esc/button_puzzle.esc @@ -0,0 +1,9 @@ +:look +say player "That must be the command to open the door." + +:use +> [!r8_m_door_open] + superpose_scene "res://game/rooms/room8/puzzle/10_buttons_puzzle.tscn" + +> [r8_m_door_open] + say player "The door is already open." diff --git a/game/rooms/room8/esc/button_reset_puzzle.esc b/game/rooms/room8/esc/button_reset_puzzle.esc new file mode 100755 index 00000000..f73f0b93 --- /dev/null +++ b/game/rooms/room8/esc/button_reset_puzzle.esc @@ -0,0 +1,6 @@ +:look +say player "That must be the command to open the door." + +:use +set_global r8_m_door_open false +set_state r8_m_door door_close diff --git a/game/rooms/room8/esc/left_exit.esc b/game/rooms/room8/esc/left_exit.esc new file mode 100755 index 00000000..bafdbb36 --- /dev/null +++ b/game/rooms/room8/esc/left_exit.esc @@ -0,0 +1,2 @@ +:exit_scene +change_scene "res://game/rooms/room7/room7.tscn" diff --git a/game/rooms/room8/esc/middle_exit.esc b/game/rooms/room8/esc/middle_exit.esc new file mode 100755 index 00000000..23245a88 --- /dev/null +++ b/game/rooms/room8/esc/middle_exit.esc @@ -0,0 +1,2 @@ +:exit_scene +#change_scene "res://game/rooms/room9/room9.tscn" diff --git a/game/rooms/room8/puzzle/10_buttons_puzzle.gd b/game/rooms/room8/puzzle/10_buttons_puzzle.gd new file mode 100644 index 00000000..18ba7552 --- /dev/null +++ b/game/rooms/room8/puzzle/10_buttons_puzzle.gd @@ -0,0 +1,60 @@ +extends Panel + +var numbers_array : Array +var next_to_be_pressed : int = 1 + +func _ready(): + randomize() + + initialize() + reset() + + for button in $GridContainer.get_children(): + button.connect("pressed", self, "_button_pressed", [button]) + + escoria.main.current_scene.game.hide_ui() + escoria.main.current_scene.hide() + + +func initialize(): + numbers_array = range(1, 11) + numbers_array.shuffle() + +func reset(): + $win_label.hide() + next_to_be_pressed = 1 + var i = 0 + for button in $GridContainer.get_children(): + var number = numbers_array[i] + button.text = str(number) + button.pressed = false + button.disabled = false + i += 1 + + +func _button_pressed(button : Button): + var number : String= button.text + if int(number) != next_to_be_pressed: + reset() + else: + button.disabled = true + next_to_be_pressed += 1 + + if next_to_be_pressed == 11: + win() + +func win(): + $win_label.show() + yield(get_tree().create_timer(2), "timeout") + hide() + + escoria.main.current_scene.game.show_ui() + escoria.main.current_scene.show() + escoria.esc_runner.set_global("r8_m_door_open", "true") + escoria.esc_runner.set_state("r8_m_door", ["door_open"]) + + +func _on_quit_pressed(): + escoria.main.current_scene.game.show_ui() + escoria.main.current_scene.show() + queue_free() diff --git a/game/rooms/room8/puzzle/10_buttons_puzzle.tscn b/game/rooms/room8/puzzle/10_buttons_puzzle.tscn new file mode 100644 index 00000000..1584f734 --- /dev/null +++ b/game/rooms/room8/puzzle/10_buttons_puzzle.tscn @@ -0,0 +1,160 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1] +[ext_resource path="res://game/rooms/room8/puzzle/10_buttons_puzzle.gd" type="Script" id=2] +[ext_resource path="res://addons/escoria-core/game/assets/fonts/efmi/efmi.TTF" type="DynamicFontData" id=3] + +[sub_resource type="DynamicFont" id=1] +size = 50 +font_data = ExtResource( 3 ) + +[sub_resource type="DynamicFont" id=2] +size = 50 +font_data = ExtResource( 3 ) + +[sub_resource type="DynamicFont" id=3] +size = 50 +font_data = ExtResource( 3 ) + +[node name="10_buttons_puzzle" type="Panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 2 ) +__meta__ = { +"_edit_lock_": true +} + +[node name="Label" type="Label" parent="."] +margin_left = 174.813 +margin_top = 79.6769 +margin_right = 899.813 +margin_bottom = 126.677 +custom_fonts/font = SubResource( 1 ) +text = "Click the buttons in the increasing order" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="win_label" type="Label" parent="."] +margin_left = 558.177 +margin_top = 674.983 +margin_right = 719.177 +margin_bottom = 721.983 +custom_fonts/font = SubResource( 2 ) +text = "Well done!" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="GridContainer" type="GridContainer" parent="."] +margin_left = 149.0 +margin_top = 190.0 +margin_right = 1122.0 +margin_bottom = 622.0 +columns = 5 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Button" type="Button" parent="GridContainer"] +margin_right = 191.0 +margin_bottom = 214.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 3 ) +toggle_mode = true + +[node name="Button2" type="Button" parent="GridContainer"] +margin_left = 195.0 +margin_right = 386.0 +margin_bottom = 214.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 3 ) +toggle_mode = true + +[node name="Button3" type="Button" parent="GridContainer"] +margin_left = 390.0 +margin_right = 581.0 +margin_bottom = 214.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 3 ) +toggle_mode = true + +[node name="Button4" type="Button" parent="GridContainer"] +margin_left = 585.0 +margin_right = 776.0 +margin_bottom = 214.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 3 ) +toggle_mode = true + +[node name="Button5" type="Button" parent="GridContainer"] +margin_left = 780.0 +margin_right = 971.0 +margin_bottom = 214.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 3 ) +toggle_mode = true + +[node name="Button6" type="Button" parent="GridContainer"] +margin_top = 218.0 +margin_right = 191.0 +margin_bottom = 432.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 3 ) +toggle_mode = true + +[node name="Button7" type="Button" parent="GridContainer"] +margin_left = 195.0 +margin_top = 218.0 +margin_right = 386.0 +margin_bottom = 432.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 3 ) +toggle_mode = true + +[node name="Button8" type="Button" parent="GridContainer"] +margin_left = 390.0 +margin_top = 218.0 +margin_right = 581.0 +margin_bottom = 432.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 3 ) +toggle_mode = true + +[node name="Button9" type="Button" parent="GridContainer"] +margin_left = 585.0 +margin_top = 218.0 +margin_right = 776.0 +margin_bottom = 432.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 3 ) +toggle_mode = true + +[node name="Button10" type="Button" parent="GridContainer"] +margin_left = 780.0 +margin_top = 218.0 +margin_right = 971.0 +margin_bottom = 432.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 3 ) +toggle_mode = true + +[node name="quit" type="Button" parent="."] +margin_left = 1148.0 +margin_top = 56.0 +margin_right = 1193.0 +margin_bottom = 109.0 +custom_fonts/font = ExtResource( 1 ) +text = "X" + +[connection signal="pressed" from="quit" to="." method="_on_quit_pressed"] diff --git a/game/rooms/room8/room8.tscn b/game/rooms/room8/room8.tscn new file mode 100644 index 00000000..95ab004b --- /dev/null +++ b/game/rooms/room8/room8.tscn @@ -0,0 +1,245 @@ +[gd_scene load_steps=11 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://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] + +[sub_resource type="NavigationPolygon" id=1] +vertices = PoolVector2Array( 1143.08, 613.35, 1267.68, 669.029, 1275.03, 799.721, -9.16094, 803.802, -6.44019, 711.297, 84.5821, 654.06, 742.298, 623.672, 581.028, 613.592, 583.548, 574.535, 707.02, 574.535, 714.58, 611.072, 3.15687, 646.051, 59.2201, 628.698, 129.634, 615.792, 530.631, 612.332, 550.79, 623.672, 783.875, 609.812 ) +polygons = [ PoolIntArray( 0, 1, 2, 3, 4, 5, 6 ), PoolIntArray( 7, 8, 9, 10 ), PoolIntArray( 4, 11, 12, 5 ), PoolIntArray( 5, 13, 14, 15 ), PoolIntArray( 7, 10, 6, 15 ), PoolIntArray( 6, 16, 0 ), PoolIntArray( 6, 5, 15 ) ] +outlines = [ PoolVector2Array( -6.44019, 711.297, 3.15687, 646.051, 59.2201, 628.698, 84.5821, 654.06, 129.634, 615.792, 530.631, 612.332, 550.79, 623.672, 581.028, 613.592, 583.548, 574.535, 707.02, 574.535, 714.58, 611.072, 742.298, 623.672, 783.875, 609.812, 1143.08, 613.35, 1267.68, 669.029, 1275.03, 799.721, -9.16094, 803.802 ) ] + +[sub_resource type="Animation" id=3] +resource_name = "door_close" +tracks/0/type = "value" +tracks/0/path = NodePath("door:polygon") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.5 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ PoolVector2Array( 557.104, 45.8, 743.623, 45.8, 744.482, 48.9414, 555.602, 48.274 ), PoolVector2Array( 557.104, 45.8, 743.623, 45.8, 746.798, 345.025, 557.898, 347.406 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath(".:is_exit") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0.6 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} + +[sub_resource type="Animation" id=4] +resource_name = "door_open" +tracks/0/type = "value" +tracks/0/path = NodePath("door:polygon") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.5 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ PoolVector2Array( 557.104, 45.8, 743.623, 45.8, 746.798, 345.025, 557.898, 347.406 ), PoolVector2Array( 557.104, 45.8, 743.623, 45.8, 744.482, 48.9414, 555.602, 48.274 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath(".:is_exit") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.6 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 1, +"values": [ false, true ] +} + +[sub_resource type="RectangleShape2D" id=2] +extents = Vector2( 20.3273, 18.0047 ) + +[node name="room8" type="Node2D"] +script = ExtResource( 6 ) +__meta__ = { +"_edit_vertical_guides_": [ ] +} +global_id = "room8" +esc_script = "res://game/rooms/room1/esc/room1.esc" +player_scene = ExtResource( 4 ) +camera_limits = [ Rect2( 0, 0, 1289, 555 ) ] + +[node name="background" type="TextureRect" parent="."] +margin_right = 1289.0 +margin_bottom = 555.0 +mouse_filter = 2 +script = ExtResource( 2 ) +__meta__ = { +"_edit_lock_": true, +"_edit_use_anchors_": false +} + +[node name="l_platform" type="Line2D" parent="background"] +position = Vector2( 2, -266 ) +points = PoolVector2Array( -2.96298, 712.01, 129.973, 614.429, 1167.5, 612.894, 1274.59, 669.705, 1273.25, 812.694, 2.36697, 811.043, 2.36697, 713.389 ) + +[node name="l_door" type="Line2D" parent="background"] +position = Vector2( 0, -266 ) +points = PoolVector2Array( 6.61201, 704.409, 6.61203, 389.558, 87.755, 339.775, 87.5463, 649.784 ) +__meta__ = { +"_editor_description_": "" +} + +[node name="m_door" type="Line2D" parent="background"] +position = Vector2( 0, -267.828 ) +points = PoolVector2Array( 555.952, 615.32, 554.538, 311.267, 744.043, 312.679, 746.871, 615.32, 557.367, 616.734 ) + +[node name="Label" type="Label" parent="background"] +margin_right = 48.0 +margin_bottom = 16.0 +custom_fonts/font = ExtResource( 3 ) +text = "Room 8" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="walkable_area" type="Navigation2D" parent="."] +script = ExtResource( 1 ) + +[node name="platform" type="NavigationPolygonInstance" parent="walkable_area"] +position = Vector2( 6.73163, -264.779 ) +navpoly = SubResource( 1 ) +__meta__ = { +"_editor_description_": "" +} + +[node name="Hotspots" type="Node2D" parent="."] + +[node name="l_door" type="Area2D" parent="Hotspots"] +script = ExtResource( 5 ) +__meta__ = { +"_editor_description_": "" +} +global_id = "r8_l_exit" +esc_script = "res://game/rooms/room8/esc/left_exit.esc" +is_exit = true +tooltip_name = "Exit" +dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 45.47, 383.99 ) +} + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/l_door"] +polygon = PoolVector2Array( 2.93237, 447.051, 2.93237, 127.051, 88.9324, 71.0505, 90.9324, 379.051 ) + +[node name="Position2D" type="Position2D" parent="Hotspots/l_door"] +position = Vector2( 45.47, 383.99 ) + +[node name="m_door" type="Area2D" parent="Hotspots"] +script = ExtResource( 5 ) +__meta__ = { +"_editor_description_": "" +} +global_id = "r8_m_door" +esc_script = "res://game/rooms/room8/esc/middle_exit.esc" +tooltip_name = "Exit" +dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 1225.47, 353.99 ) +} + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/m_door"] +polygon = PoolVector2Array( 557.522, 348.813, 551.222, 42.6524, 743.99, 43.9123, 750.289, 345.033 ) + +[node name="Position2D" type="Position2D" parent="Hotspots/m_door"] +position = Vector2( 653.466, 366.589 ) + +[node name="door" type="Polygon2D" parent="Hotspots/m_door"] +color = Color( 0.4, 0.501961, 1, 1 ) +polygon = PoolVector2Array( 557.104, 45.8, 743.623, 45.8, 746.798, 345.025, 557.898, 347.406 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Hotspots/m_door"] +anims/door_close = SubResource( 3 ) +anims/door_open = SubResource( 4 ) + +[node name="r8_mini_puzzle_button" type="Area2D" parent="Hotspots"] +script = ExtResource( 5 ) +global_id = "r8_button_puzzle" +esc_script = "res://game/rooms/room8/esc/button_puzzle.esc" +tooltip_name = "Button" +default_action = "use" +dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": null +} + +[node name="button" type="Line2D" parent="Hotspots/r8_mini_puzzle_button"] +position = Vector2( -588.313, 5.65686 ) +points = PoolVector2Array( 1048.39, 178.619, 1048.39, 208.814, 1076.99, 208.814, 1078.05, 183.387, 1052.09, 183.916 ) +default_color = Color( 0.4, 0.501961, 1, 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Hotspots/r8_mini_puzzle_button"] +position = Vector2( 474.343, 201.414 ) +shape = SubResource( 2 ) + +[node name="Position2D" type="Position2D" parent="Hotspots/r8_mini_puzzle_button"] +position = Vector2( 474.801, 369.29 ) + +[node name="button_puzzle" type="Label" parent="Hotspots/r8_mini_puzzle_button"] +margin_left = 445.617 +margin_top = 166.124 +margin_right = 508.617 +margin_bottom = 182.124 +custom_fonts/font = ExtResource( 3 ) +text = "Run puzzle" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="r8_reset_puzzle_button" type="Area2D" parent="Hotspots"] +position = Vector2( -139.185, 0 ) +script = ExtResource( 5 ) +global_id = "r8_button_reset_puzzle" +esc_script = "res://game/rooms/room8/esc/button_reset_puzzle.esc" +tooltip_name = "Button" +default_action = "use" +dialog_color = Color( 1, 1, 1, 1 ) +interact_positions = { +"default": Vector2( 474.801, 369.29 ) +} + +[node name="button" type="Line2D" parent="Hotspots/r8_reset_puzzle_button"] +position = Vector2( -588.313, 5.65686 ) +points = PoolVector2Array( 1048.39, 178.619, 1048.39, 208.814, 1076.99, 208.814, 1078.05, 183.387, 1052.09, 183.916 ) +default_color = Color( 0.4, 0.501961, 1, 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Hotspots/r8_reset_puzzle_button"] +position = Vector2( 474.343, 201.414 ) +shape = SubResource( 2 ) + +[node name="Position2D" type="Position2D" parent="Hotspots/r8_reset_puzzle_button"] +position = Vector2( 474.801, 369.29 ) + +[node name="reset_puzzle" type="Label" parent="Hotspots/r8_reset_puzzle_button"] +margin_left = 441.128 +margin_top = 166.124 +margin_right = 512.128 +margin_bottom = 182.124 +custom_fonts/font = ExtResource( 3 ) +text = "Reset puzzle" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="player_start" type="Position2D" parent="."] +position = Vector2( 76.7617, 437.649 ) diff --git a/game/start_game.esc b/game/start_game.esc index 5851a9af..007e1fd6 100755 --- a/game/start_game.esc +++ b/game/start_game.esc @@ -20,5 +20,7 @@ # 7/ long room with camera shift to object 2 if look on object 1 # and stairs with camera shift too -change_scene res://game/rooms/room7/room7.tscn +#change_scene res://game/rooms/room7/room7.tscn +# 8/ puzzle in superposed scene +change_scene res://game/rooms/room8/room8.tscn diff --git a/game/ui/ui_9verbs/game.gd b/game/ui/ui_9verbs/game.gd index cc1f3c0e..872d8e94 100644 --- a/game/ui/ui_9verbs/game.gd +++ b/game/ui/ui_9verbs/game.gd @@ -112,3 +112,15 @@ func close_inventory(): func mousewheel_action(direction : int): pass + +func hide_ui(): + $ui/panel_down.hide() + $ui/verbs_layer/verbs_menu.hide() + $ui/inventory_layer/inventory_ui.hide() + $ui/tooltip_layer/tooltip.hide() + +func show_ui(): + $ui/panel_down.show() + $ui/verbs_layer/verbs_menu.show() + $ui/inventory_layer/inventory_ui.show() + $ui/tooltip_layer/tooltip.show()