diff --git a/UI/menu.gd b/UI/menu.gd new file mode 100644 index 0000000..6986d64 --- /dev/null +++ b/UI/menu.gd @@ -0,0 +1,17 @@ +extends Control + +var destination_map = { + "oustide":preload("res://scenes/outside.tscn"), +} + +signal start +signal save + +var instanciated_destinations = {} + +func _on_button_pressed() -> void: + emit_signal("start") + $MarginContainer/Panel/VBoxContainer/Button.text="continue" + +func _on_save_pressed() -> void: + emit_signal("save") diff --git a/UI/menu.tscn b/UI/menu.tscn new file mode 100644 index 0000000..0ef0124 --- /dev/null +++ b/UI/menu.tscn @@ -0,0 +1,62 @@ +[gd_scene load_steps=5 format=3 uid="uid://44wla7mlivqm"] + +[ext_resource type="Script" path="res://UI/menu.gd" id="1_30mo7"] +[ext_resource type="FontFile" uid="uid://c1lnxul6k2adw" path="res://assest/font/vhs-gothic.ttf" id="2_6inip"] +[ext_resource type="Theme" uid="uid://bn1flbuijm27d" path="res://UI/menu_button.tres" id="3_feq31"] + +[sub_resource type="LabelSettings" id="LabelSettings_q3w7i"] +line_spacing = 45.0 +font = ExtResource("2_6inip") +font_size = 60 + +[node name="Menu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_30mo7") + +[node name="MarginContainer" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Panel" type="Panel" parent="MarginContainer"] +layout_mode = 2 +size_flags_stretch_ratio = 1.37 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/Panel"] +layout_mode = 2 +offset_right = 1920.0 +offset_bottom = 1080.0 + +[node name="Label" type="Label" parent="MarginContainer/Panel/VBoxContainer"] +layout_mode = 2 +text = " +Chaussette sale, le jeu! + +" +label_settings = SubResource("LabelSettings_q3w7i") +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="HSeparator" type="HSeparator" parent="MarginContainer/Panel/VBoxContainer"] +layout_mode = 2 + +[node name="Button" type="Button" parent="MarginContainer/Panel/VBoxContainer"] +layout_mode = 2 +theme = ExtResource("3_feq31") +text = "start" + +[node name="Save" type="Button" parent="MarginContainer/Panel/VBoxContainer"] +layout_mode = 2 +theme = ExtResource("3_feq31") +text = "save" + +[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Button" to="." method="_on_button_pressed"] +[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Save" to="." method="_on_save_pressed"] diff --git a/UI/menu_button.tres b/UI/menu_button.tres new file mode 100644 index 0000000..a3b6f93 --- /dev/null +++ b/UI/menu_button.tres @@ -0,0 +1,4 @@ +[gd_resource type="Theme" format=3 uid="uid://bn1flbuijm27d"] + +[resource] +default_font_size = 60 diff --git a/game_state.gd b/game_state.gd index 8635290..adc9ccf 100644 --- a/game_state.gd +++ b/game_state.gd @@ -5,3 +5,6 @@ var hasChosenNotToMakeChoices = false var hasChosenToMakeChoices = false var hasCompletedBobDialogue = false var playerIsDeaf = false + +var player_positions = {"res://scenes/start.tscn" = Vector2(-171, -253)} +var current_scene = "res://scenes/start.tscn" diff --git a/project.godot b/project.godot index dd3e2a6..7dbae86 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="chaussette.sale" -run/main_scene="res://scenes/start.tscn" +run/main_scene="res://scenes/game.tscn" config/features=PackedStringArray("4.3", "GL Compatibility") config/icon="res://icon.svg" @@ -38,6 +38,10 @@ enabled=PackedStringArray("res://addons/dialogue_manager/plugin.cfg") folder_colors={} +[gui] + +theme/custom_font="res://assest/font/vhs-gothic.ttf" + [input] move_right={ @@ -69,6 +73,11 @@ grab={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } +menu={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} [internationalization] diff --git a/scenes/game.gd b/scenes/game.gd new file mode 100644 index 0000000..290399a --- /dev/null +++ b/scenes/game.gd @@ -0,0 +1,27 @@ +extends Node2D + +var destination_map = { + "oustide":preload("res://scenes/outside.tscn"), +} + +func _unhandled_input(event: InputEvent) -> void: + if event.is_action_pressed("menu"): + open_menu() + +# list of scenes +var current_scene = "menu" +var outside = null +var menu = null + +func start_game(): + menu = get_child(0) + if outside == null: + outside = destination_map["oustide"].instantiate() + add_child(outside) + remove_child(menu) + current_scene = "outside" + +func open_menu(): + remove_child(outside) + add_child(menu) + current_scene = "menu" diff --git a/scenes/game.tscn b/scenes/game.tscn new file mode 100644 index 0000000..5bdd043 --- /dev/null +++ b/scenes/game.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=3 format=3 uid="uid://c645h6ap7niu1"] + +[ext_resource type="PackedScene" uid="uid://44wla7mlivqm" path="res://UI/menu.tscn" id="1_64gp8"] +[ext_resource type="Script" path="res://scenes/game.gd" id="1_b2ju7"] + +[node name="Game" type="Node2D"] +script = ExtResource("1_b2ju7") + +[node name="Menu" parent="." instance=ExtResource("1_64gp8")] + +[connection signal="start" from="Menu" to="." method="start_game"] diff --git a/scenes/start.tscn b/scenes/outside.tscn similarity index 82% rename from scenes/start.tscn rename to scenes/outside.tscn index a1701fb..4cec809 100644 --- a/scenes/start.tscn +++ b/scenes/outside.tscn @@ -1,10 +1,10 @@ [gd_scene load_steps=8 format=3 uid="uid://b4ydi1vv8dvwr"] -[ext_resource type="PackedScene" uid="uid://d1oqt6sbjvopi" path="res://maps/world.tscn" id="1_6vs81"] -[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="2_5x6b5"] -[ext_resource type="PackedScene" uid="uid://cl201baro5y5" path="res://vehicules/npc_car.tscn" id="3_yuakw"] -[ext_resource type="PackedScene" uid="uid://bt1p311rn1h6q" path="res://vehicules/car.tscn" id="4_bqm78"] -[ext_resource type="PackedScene" uid="uid://bleadp4yrdgj" path="res://caracters/bob/bob.tscn" id="5_n64eb"] +[ext_resource type="PackedScene" uid="uid://d1oqt6sbjvopi" path="res://maps/world.tscn" id="1_ysg4m"] +[ext_resource type="PackedScene" uid="uid://bleadp4yrdgj" path="res://caracters/bob/bob.tscn" id="2_vbahy"] +[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="3_bt1tp"] +[ext_resource type="PackedScene" uid="uid://cl201baro5y5" path="res://vehicules/npc_car.tscn" id="4_dt4vq"] +[ext_resource type="PackedScene" uid="uid://bt1p311rn1h6q" path="res://vehicules/car.tscn" id="5_4nlh0"] [sub_resource type="Curve2D" id="Curve2D_shblg"] _data = { @@ -20,12 +20,12 @@ point_count = 20 [node name="scene1" type="Node2D"] -[node name="world" parent="." instance=ExtResource("1_6vs81")] +[node name="world" parent="." instance=ExtResource("1_ysg4m")] -[node name="bob" parent="world" instance=ExtResource("5_n64eb")] +[node name="bob" parent="world" instance=ExtResource("2_vbahy")] position = Vector2(-333, -262) -[node name="player" parent="world" instance=ExtResource("2_5x6b5")] +[node name="player" parent="world" instance=ExtResource("3_bt1tp")] position = Vector2(-171, -253) [node name="movibles" type="Node2D" parent="."] @@ -36,25 +36,25 @@ position = Vector2(-171, -253) position = Vector2(-664, 181) curve = SubResource("Curve2D_shblg") -[node name="voiture_pnj" parent="movibles/cars/Path2D" node_paths=PackedStringArray("car", "world") instance=ExtResource("3_yuakw")] +[node name="voiture_pnj" parent="movibles/cars/Path2D" node_paths=PackedStringArray("car", "world") instance=ExtResource("4_dt4vq")] position = Vector2(-285, 193) car = NodePath("../Car") distanceMax = 400 world = NodePath("../../../../world") -[node name="Car" parent="movibles/cars/Path2D" instance=ExtResource("4_bqm78")] +[node name="Car" parent="movibles/cars/Path2D" instance=ExtResource("5_4nlh0")] position = Vector2(-287, 196) speed = 500 [node name="Path2D2" type="Path2D" parent="movibles/cars"] curve = SubResource("Curve2D_nircx") -[node name="voiture_pnj" parent="movibles/cars/Path2D2" node_paths=PackedStringArray("car", "world") instance=ExtResource("3_yuakw")] +[node name="voiture_pnj" parent="movibles/cars/Path2D2" node_paths=PackedStringArray("car", "world") instance=ExtResource("4_dt4vq")] position = Vector2(794, 1374) car = NodePath("../Car") distanceMax = 400 world = NodePath("../../../../world") -[node name="Car" parent="movibles/cars/Path2D2" instance=ExtResource("4_bqm78")] +[node name="Car" parent="movibles/cars/Path2D2" instance=ExtResource("5_4nlh0")] position = Vector2(790, 1372) speed = 500