diff --git a/common/game_data/scripts/game_data.gd b/common/game_data/scripts/game_data.gd index 579fc71..dcab052 100644 --- a/common/game_data/scripts/game_data.gd +++ b/common/game_data/scripts/game_data.gd @@ -3,18 +3,35 @@ class_name GameData signal current_planet_data_updated(p : PlanetData) +func _init(): + set_default_unlocked() + +@export var tutorial_done = false + @export var current_planet_data : PlanetData : set(v): current_planet_data = v current_planet_data_updated.emit(v) -@export var unlocked_plant_types_path : Array[PlantType] = [ - preload("res://entities/plants/resources/plant_types/champ.tres"), - preload("res://entities/plants/resources/plant_types/chardi.tres"), - preload("res://entities/plants/resources/plant_types/maias.tres"), - preload("res://entities/plants/resources/plant_types/pili.tres"), -] +@export var unlocked_plant_types : Array[PlantType] = [] -@export var unlocked_machines : Array[MachineType] = [ - preload("res://entities/interactables/machines/compost/compost.tres") -] \ No newline at end of file +@export var unlocked_machines : Array[MachineType] = [] + +func set_default_unlocked(): + unlocked_plant_types = all_plant_types() + unlocked_machines = all_machines() + +func all_plant_types() -> Array[PlantType]: + return [ + preload("res://entities/plants/resources/plant_types/champ.tres"), + preload("res://entities/plants/resources/plant_types/chardi.tres"), + preload("res://entities/plants/resources/plant_types/maias.tres"), + preload("res://entities/plants/resources/plant_types/pili.tres"), + ] + +func all_machines() -> Array[MachineType]: + return [ + preload("res://entities/interactables/machines/compost/compost_types/energy_compost.tres"), + preload("res://entities/interactables/machines/compost/compost_types/seed_compost.tres"), + preload("res://entities/interactables/machines/solar_pannel/solar_pannel.tres"), + ] \ No newline at end of file diff --git a/common/game_data/scripts/planet_data.gd b/common/game_data/scripts/planet_data.gd index 68073cd..6a95e69 100644 --- a/common/game_data/scripts/planet_data.gd +++ b/common/game_data/scripts/planet_data.gd @@ -76,7 +76,7 @@ func generate_objective_rewards(level = 0) -> Array[ObjectiveReward]: #region ------------------ Quotas ------------------ func get_quota(n = 0) -> int: - var first_quota = 100 + var first_quota = 50 var quota_adding = n * 100 if n == 0: diff --git a/common/icons/arrow-narrow-down.svg b/common/icons/arrow-narrow-down.svg new file mode 100644 index 0000000..ec3ca91 --- /dev/null +++ b/common/icons/arrow-narrow-down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/common/icons/arrow-narrow-down.svg.import b/common/icons/arrow-narrow-down.svg.import new file mode 100644 index 0000000..e22fcc3 --- /dev/null +++ b/common/icons/arrow-narrow-down.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bsgmxvuphn73c" +path="res://.godot/imported/arrow-narrow-down.svg-cb15fd62c6ff45344ee03077f9caed2e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://common/icons/arrow-narrow-down.svg" +dest_files=["res://.godot/imported/arrow-narrow-down.svg-cb15fd62c6ff45344ee03077f9caed2e.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=2.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/common/icons/arrow-narrow-left.svg b/common/icons/arrow-narrow-left.svg new file mode 100644 index 0000000..1a3dca6 --- /dev/null +++ b/common/icons/arrow-narrow-left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/common/icons/arrow-narrow-left.svg.import b/common/icons/arrow-narrow-left.svg.import new file mode 100644 index 0000000..92df39b --- /dev/null +++ b/common/icons/arrow-narrow-left.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://7oh782g7ngop" +path="res://.godot/imported/arrow-narrow-left.svg-a856ad349eaa44596bec4c45b7837e6b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://common/icons/arrow-narrow-left.svg" +dest_files=["res://.godot/imported/arrow-narrow-left.svg-a856ad349eaa44596bec4c45b7837e6b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=2.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/common/icons/arrow-narrow-right.svg b/common/icons/arrow-narrow-right.svg new file mode 100644 index 0000000..ccd98e4 --- /dev/null +++ b/common/icons/arrow-narrow-right.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/common/icons/arrow-narrow-right.svg.import b/common/icons/arrow-narrow-right.svg.import new file mode 100644 index 0000000..c23bfe2 --- /dev/null +++ b/common/icons/arrow-narrow-right.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bgi4rc50par30" +path="res://.godot/imported/arrow-narrow-right.svg-3f8a5cd0651f044c9c35e0fe78677364.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://common/icons/arrow-narrow-right.svg" +dest_files=["res://.godot/imported/arrow-narrow-right.svg-3f8a5cd0651f044c9c35e0fe78677364.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=2.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/common/icons/arrow-narrow-up.svg b/common/icons/arrow-narrow-up.svg new file mode 100644 index 0000000..aeaa1f6 --- /dev/null +++ b/common/icons/arrow-narrow-up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/common/icons/arrow-narrow-up.svg.import b/common/icons/arrow-narrow-up.svg.import new file mode 100644 index 0000000..bebd832 --- /dev/null +++ b/common/icons/arrow-narrow-up.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://eug5icp6t1h3" +path="res://.godot/imported/arrow-narrow-up.svg-3e96282c2af955cf23507b48c4348810.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://common/icons/arrow-narrow-up.svg" +dest_files=["res://.godot/imported/arrow-narrow-up.svg-3e96282c2af955cf23507b48c4348810.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=2.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/common/music/music.tscn b/common/music/music.tscn index d0ded5b..f981294 100644 --- a/common/music/music.tscn +++ b/common/music/music.tscn @@ -9,7 +9,7 @@ process_mode = 3 script = ExtResource("1_ji160") decontamination_musics = [NodePath("ForestPhase1"), NodePath("ForestPhase2")] -decontamination_musics_levels = Array[float]([0.0, 30.0]) +decontamination_musics_levels = Array[float]([0.0, 100.0]) [node name="ForestPhase1" type="AudioStreamPlayer" parent="."] stream = ExtResource("1_stre8") diff --git a/common/music/scripts/music.gd b/common/music/scripts/music.gd index d8b8850..8490182 100644 --- a/common/music/scripts/music.gd +++ b/common/music/scripts/music.gd @@ -22,8 +22,6 @@ func _on_contamination_updated(decontamination_surface : float): for level in range(1, len(decontamination_musics_levels)): if decontamination_surface > decontamination_musics_levels[level]: actual_level = level - - print(actual_level) if len(decontamination_musics) > actual_level: play_music(decontamination_musics[actual_level]) diff --git a/entities/interactables/machines/compost/compost.tres b/entities/interactables/machines/compost/compost.tres deleted file mode 100644 index 15bceb6..0000000 --- a/entities/interactables/machines/compost/compost.tres +++ /dev/null @@ -1,10 +0,0 @@ -[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://cv2tf0tydqj5v"] - -[ext_resource type="PackedScene" uid="uid://bkwh1ntvgkkrt" path="res://entities/interactables/machines/compost/compost.tscn" id="1_8ajib"] -[ext_resource type="Script" path="res://entities/interactables/machines/scripts/machine_info.gd" id="1_vktn1"] - -[resource] -script = ExtResource("1_vktn1") -name = "Compost" -scene = ExtResource("1_8ajib") -description = "Can generate temporary energy in exchange of seeds." diff --git a/entities/interactables/machines/compost/compost_types/energy_compost.tres b/entities/interactables/machines/compost/compost_types/energy_compost.tres new file mode 100644 index 0000000..f6c7da6 --- /dev/null +++ b/entities/interactables/machines/compost/compost_types/energy_compost.tres @@ -0,0 +1,10 @@ +[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://cv2tf0tydqj5v"] + +[ext_resource type="PackedScene" uid="uid://bkwh1ntvgkkrt" path="res://entities/interactables/machines/compost/compost_types/energy_compost.tscn" id="1_sy5wj"] +[ext_resource type="Script" uid="uid://bhncww816fjsb" path="res://entities/interactables/machines/scripts/machine_info.gd" id="2_m8wft"] + +[resource] +script = ExtResource("2_m8wft") +name = "Energy Compost" +scene = ExtResource("1_sy5wj") +description = "Can generate temporary energy in exchange of seeds." diff --git a/entities/interactables/machines/compost/compost.tscn b/entities/interactables/machines/compost/compost_types/energy_compost.tscn similarity index 82% rename from entities/interactables/machines/compost/compost.tscn rename to entities/interactables/machines/compost/compost_types/energy_compost.tscn index dc23b90..7fb2563 100644 --- a/entities/interactables/machines/compost/compost.tscn +++ b/entities/interactables/machines/compost/compost_types/energy_compost.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=11 format=3 uid="uid://bkwh1ntvgkkrt"] -[ext_resource type="Script" uid="uid://dw6jgsasb2fe1" path="res://entities/interactables/machines/compost/scripts/compost.gd" id="1_c0pig"] -[ext_resource type="Texture2D" uid="uid://f2rte5jc0psp" path="res://entities/interactables/machines/compost/assets/sprites/compost.svg" id="2_r6435"] -[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_akkx7"] +[ext_resource type="Script" uid="uid://bw2ckthka71y8" path="res://entities/interactables/machines/compost/scripts/energy_compost.gd" id="1_2s0lp"] +[ext_resource type="Texture2D" uid="uid://f2rte5jc0psp" path="res://entities/interactables/machines/compost/assets/sprites/compost.svg" id="2_pi0jt"] +[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_85qj7"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_akkx7"] size = Vector2(66, 84) @@ -26,7 +26,7 @@ length = 0.001 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("Compost:scale") +tracks/0/path = NodePath("Sprite:scale") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -38,7 +38,7 @@ tracks/0/keys = { tracks/1/type = "value" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("Compost:position") +tracks/1/path = NodePath("Sprite:position") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/keys = { @@ -54,7 +54,7 @@ length = 0.5 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("Compost:position") +tracks/0/path = NodePath("Sprite:position") tracks/0/interp = 2 tracks/0/loop_wrap = true tracks/0/keys = { @@ -66,7 +66,7 @@ tracks/0/keys = { tracks/1/type = "value" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("Compost:scale") +tracks/1/path = NodePath("Sprite:scale") tracks/1/interp = 2 tracks/1/loop_wrap = true tracks/1/keys = { @@ -82,7 +82,7 @@ length = 0.3 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("Compost:scale") +tracks/0/path = NodePath("Sprite:scale") tracks/0/interp = 2 tracks/0/loop_wrap = true tracks/0/keys = { @@ -99,18 +99,19 @@ _data = { &"fill": SubResource("Animation_etofw") } -[node name="Compost" type="Area2D"] -script = ExtResource("1_c0pig") +[node name="EnergyCompost" type="Area2D"] +script = ExtResource("1_2s0lp") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("RectangleShape2D_akkx7") -[node name="Compost" type="Sprite2D" parent="."] +[node name="Sprite" type="Sprite2D" parent="."] +unique_name_in_owner = true self_modulate = Color(0.729698, 0.588265, 0.105405, 1) scale = Vector2(0.291262, 0.291262) -texture = ExtResource("2_r6435") +texture = ExtResource("2_pi0jt") -[node name="ProgressBar" type="ProgressBar" parent="Compost"] +[node name="ProgressBar" type="ProgressBar" parent="Sprite"] unique_name_in_owner = true offset_left = -62.0 offset_top = -7.0 @@ -121,11 +122,11 @@ theme_override_styles/fill = SubResource("StyleBoxFlat_3ao1n") fill_mode = 3 show_percentage = false -[node name="Bolt" type="Sprite2D" parent="Compost"] +[node name="Bolt" type="Sprite2D" parent="Sprite"] z_index = 1 position = Vector2(0, 54.9334) scale = Vector2(2.00278, 2.00278) -texture = ExtResource("3_akkx7") +texture = ExtResource("3_85qj7") [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { diff --git a/entities/interactables/machines/compost/compost_types/seed_compost.tres b/entities/interactables/machines/compost/compost_types/seed_compost.tres new file mode 100644 index 0000000..a23b7ba --- /dev/null +++ b/entities/interactables/machines/compost/compost_types/seed_compost.tres @@ -0,0 +1,11 @@ +[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://bbaiexmnroxos"] + +[ext_resource type="PackedScene" uid="uid://b13debm055r3t" path="res://entities/interactables/machines/compost/compost_types/seed_compost.tscn" id="1_vpkcm"] +[ext_resource type="Script" uid="uid://bhncww816fjsb" path="res://entities/interactables/machines/scripts/machine_info.gd" id="2_tfoq0"] + +[resource] +script = ExtResource("2_tfoq0") +name = "Seed Compost" +scene = ExtResource("1_vpkcm") +description = "Give random seed if is filled with seeds." +metadata/_custom_type_script = "uid://bhncww816fjsb" diff --git a/entities/interactables/machines/compost/compost_types/seed_compost.tscn b/entities/interactables/machines/compost/compost_types/seed_compost.tscn new file mode 100644 index 0000000..e780843 --- /dev/null +++ b/entities/interactables/machines/compost/compost_types/seed_compost.tscn @@ -0,0 +1,134 @@ +[gd_scene load_steps=11 format=3 uid="uid://b13debm055r3t"] + +[ext_resource type="Script" uid="uid://d0yt8pd41j2os" path="res://entities/interactables/machines/compost/scripts/seed_compost.gd" id="1_b8mmk"] +[ext_resource type="Texture2D" uid="uid://f2rte5jc0psp" path="res://entities/interactables/machines/compost/assets/sprites/compost.svg" id="2_s8eov"] +[ext_resource type="Texture2D" uid="uid://b0wy3dbpxbnt7" path="res://common/icons/seedling.svg" id="3_s8eov"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_akkx7"] +size = Vector2(66, 84) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_etofw"] +bg_color = Color(0.260098, 0.11665, 0.0419712, 0.231373) +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3ao1n"] +bg_color = Color(0.270222, 0.270222, 0.270222, 1) +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 + +[sub_resource type="Animation" id="Animation_r6435"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0.291262, 0.291262)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Sprite:position") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} + +[sub_resource type="Animation" id="Animation_1758a"] +resource_name = "empty" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite:position") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.5), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(0, 0), Vector2(0, 12.605), Vector2(0, -24.56), Vector2(0, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Sprite:scale") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.5), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(0.291262, 0.291262), Vector2(0.291, 0.191), Vector2(0.291, 0.366), Vector2(0.291262, 0.291262)] +} + +[sub_resource type="Animation" id="Animation_etofw"] +resource_name = "fill" +length = 0.3 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite:scale") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Vector2(0.291262, 0.291262), Vector2(0.291, 0.231), Vector2(0.291262, 0.291262)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_etofw"] +_data = { +&"RESET": SubResource("Animation_r6435"), +&"empty": SubResource("Animation_1758a"), +&"fill": SubResource("Animation_etofw") +} + +[node name="Compost" type="Area2D"] +script = ExtResource("1_b8mmk") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_akkx7") + +[node name="Sprite" type="Sprite2D" parent="."] +unique_name_in_owner = true +self_modulate = Color(0.90820795, 0.68268144, 0.2216644, 1) +scale = Vector2(0.291262, 0.291262) +texture = ExtResource("2_s8eov") + +[node name="ProgressBar" type="ProgressBar" parent="Sprite"] +unique_name_in_owner = true +offset_left = -62.0 +offset_top = -7.0 +offset_right = 62.0 +offset_bottom = 120.0 +theme_override_styles/background = SubResource("StyleBoxFlat_etofw") +theme_override_styles/fill = SubResource("StyleBoxFlat_3ao1n") +fill_mode = 3 +show_percentage = false + +[node name="Bolt" type="Sprite2D" parent="Sprite"] +z_index = 1 +position = Vector2(0, 54.9334) +scale = Vector2(2.00278, 2.00278) +texture = ExtResource("3_s8eov") + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +&"": SubResource("AnimationLibrary_etofw") +} diff --git a/entities/interactables/machines/compost/scripts/compost.gd b/entities/interactables/machines/compost/scripts/compost.gd index afab4cb..7671e69 100644 --- a/entities/interactables/machines/compost/scripts/compost.gd +++ b/entities/interactables/machines/compost/scripts/compost.gd @@ -5,17 +5,14 @@ var containing_seed : int = 0 func get_seed_needed(l : int = level) -> int: match l: - 1: return 3 - 2: return 2 - 3: return 2 - _: return 1 - -func get_energy_production(l : int = level) -> int: - match l: - 1: return 1 - 2: return 1 + 1: return 5 + 2: return 4 + 3: return 3 _: return 2 +func setup_machine_sprite(): + %Sprite.self_modulate = Machine.get_level_color(level) + func _process(_delta): %ProgressBar.value = lerp(%ProgressBar.value, float(containing_seed) / float(get_seed_needed()) * 100, 0.5) @@ -35,7 +32,10 @@ func interact(p : Player) -> bool: if containing_seed >= get_seed_needed(): $AnimationPlayer.play("empty") containing_seed = 0 - p.recharge(get_energy_production()) + product(p) else: $AnimationPlayer.play("fill") return true + +func product(player : Player): + pass diff --git a/entities/interactables/machines/compost/scripts/energy_compost.gd b/entities/interactables/machines/compost/scripts/energy_compost.gd new file mode 100644 index 0000000..cd9f659 --- /dev/null +++ b/entities/interactables/machines/compost/scripts/energy_compost.gd @@ -0,0 +1,12 @@ +extends Compost +class_name EnergyCompost + +func get_energy_production(l : int = level) -> int: + match l: + 1: return 1 + 2: return 1 + 3: return 1 + _: return 1 + +func product(player : Player): + player.recharge(get_energy_production()) \ No newline at end of file diff --git a/entities/interactables/machines/compost/scripts/energy_compost.gd.uid b/entities/interactables/machines/compost/scripts/energy_compost.gd.uid new file mode 100644 index 0000000..3073107 --- /dev/null +++ b/entities/interactables/machines/compost/scripts/energy_compost.gd.uid @@ -0,0 +1 @@ +uid://bw2ckthka71y8 diff --git a/entities/interactables/machines/compost/scripts/seed_compost.gd b/entities/interactables/machines/compost/scripts/seed_compost.gd new file mode 100644 index 0000000..f2ddffc --- /dev/null +++ b/entities/interactables/machines/compost/scripts/seed_compost.gd @@ -0,0 +1,17 @@ +extends Compost +class_name SeedCompost + +func get_seeds_production(l : int = level) -> int: + match l: + 1: return 2 + 2: return 2 + 3: return 2 + _: return 1 + +func product(player : Player): + for i in range(get_seeds_production()): + player.planet.drop_item( + Seed.new(GameInfo.game_data.unlocked_plant_types.pick_random()), + global_position, + 100 + ) \ No newline at end of file diff --git a/entities/interactables/machines/compost/scripts/seed_compost.gd.uid b/entities/interactables/machines/compost/scripts/seed_compost.gd.uid new file mode 100644 index 0000000..d7adea3 --- /dev/null +++ b/entities/interactables/machines/compost/scripts/seed_compost.gd.uid @@ -0,0 +1 @@ +uid://d0yt8pd41j2os diff --git a/entities/interactables/machines/scripts/machine.gd b/entities/interactables/machines/scripts/machine.gd index 8d64080..fd9d4ea 100644 --- a/entities/interactables/machines/scripts/machine.gd +++ b/entities/interactables/machines/scripts/machine.gd @@ -1,7 +1,7 @@ extends Interactable class_name Machine -const MAX_MACHINE_LEVEL = 5 +const MAX_MACHINE_LEVEL = 3 var level : int = 1 var machine_name : String = "" @@ -11,6 +11,10 @@ func setup_machine_info(machine_type : MachineType, _level : int = 1): level = _level machine_name = machine_type.name machine_desc = machine_type.description + setup_machine_sprite() + +func setup_machine_sprite(): + pass func pointer_text(): return machine_name @@ -20,3 +24,10 @@ func inspector_info() -> Inspector.Info: pointer_text() + " level " + str(level), machine_desc ) + +static func get_level_color(l : int) -> Color: + match l: + 1: return Color("4ed38a") + 2: return Color("4ec6ee") + 3: return Color("bd70e2") + _: return Color("bd70e2") \ No newline at end of file diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png new file mode 100644 index 0000000..ff1c94c Binary files /dev/null and b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png differ diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png.import b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png.import new file mode 100644 index 0000000..e8ebe9c --- /dev/null +++ b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cqqlkm14lawpa" +path="res://.godot/imported/panneau_solaire_1.png-b9a4049f295152380ed394a82c03b8e2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png" +dest_files=["res://.godot/imported/panneau_solaire_1.png-b9a4049f295152380ed394a82c03b8e2.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png new file mode 100644 index 0000000..d2fffe4 Binary files /dev/null and b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png differ diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png.import b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png.import new file mode 100644 index 0000000..01643de --- /dev/null +++ b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b1n8nad43usw4" +path="res://.godot/imported/panneau_solaire_2.png-479b68803815c59c599ff8c3a78ca895.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png" +dest_files=["res://.godot/imported/panneau_solaire_2.png-479b68803815c59c599ff8c3a78ca895.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png new file mode 100644 index 0000000..169f6e1 Binary files /dev/null and b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png differ diff --git a/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png.import b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png.import new file mode 100644 index 0000000..0c78bc8 --- /dev/null +++ b/entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c22re5wfsm1ax" +path="res://.godot/imported/panneau_solaire_3.png-022ae039aa352e1519471d4f9c114a8b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png" +dest_files=["res://.godot/imported/panneau_solaire_3.png-022ae039aa352e1519471d4f9c114a8b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd b/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd new file mode 100644 index 0000000..2f05eec --- /dev/null +++ b/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd @@ -0,0 +1,49 @@ +extends Machine +class_name SolarPanel + +var charged : bool = false : set = set_charged +var recharge_days : int = 0 + +func get_days_to_recharge(l : int = level) -> int: + match l: + 1: return 2 + 2: return 2 + 3: return 2 + _: return 1 + +func get_energy_production(l : int = level) -> int: + match l: + 1: return 1 + 2: return 2 + 3: return 3 + _: return 1 + +# Méthode déclenchée par la classe planet +func _pass_day(): + if not charged: + recharge_days += 1 + print(get_days_to_recharge()) + if recharge_days >= get_days_to_recharge(): + set_charged(true) + +func set_charged(_charged = true): + charged = _charged + recharge_days = 0 + if charged: + %AnimationPlayer.play("charged") + else : + %AnimationPlayer.play_backwards("charged") + +func setup_machine_sprite(): + %Base.self_modulate = Machine.get_level_color(level) + +func interact_text(): + return "Recharge " + str(get_energy_production()) + " energy" + +func can_interact(_p : Player) -> bool: + return charged + +func interact(p : Player) -> bool: + p.recharge(get_energy_production()) + set_charged(false) + return true diff --git a/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd.uid b/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd.uid new file mode 100644 index 0000000..bf728bb --- /dev/null +++ b/entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd.uid @@ -0,0 +1 @@ +uid://bjy8gc0eyl2ss diff --git a/entities/interactables/machines/solar_pannel/solar_pannel.tres b/entities/interactables/machines/solar_pannel/solar_pannel.tres new file mode 100644 index 0000000..1e7d0cf --- /dev/null +++ b/entities/interactables/machines/solar_pannel/solar_pannel.tres @@ -0,0 +1,11 @@ +[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://dew3p4fffjryo"] + +[ext_resource type="Script" uid="uid://bhncww816fjsb" path="res://entities/interactables/machines/scripts/machine_info.gd" id="1_ctita"] +[ext_resource type="PackedScene" uid="uid://gwq2oos6ljyp" path="res://entities/interactables/machines/solar_pannel/solar_pannel.tscn" id="1_naexs"] + +[resource] +script = ExtResource("1_ctita") +name = "Solar Pannel" +scene = ExtResource("1_naexs") +description = "Produce energy evry 2 days. When charged, can be used to recharge energy." +metadata/_custom_type_script = "uid://bhncww816fjsb" diff --git a/entities/interactables/machines/solar_pannel/solar_pannel.tscn b/entities/interactables/machines/solar_pannel/solar_pannel.tscn new file mode 100644 index 0000000..1552193 --- /dev/null +++ b/entities/interactables/machines/solar_pannel/solar_pannel.tscn @@ -0,0 +1,99 @@ +[gd_scene load_steps=9 format=3 uid="uid://gwq2oos6ljyp"] + +[ext_resource type="Script" uid="uid://bjy8gc0eyl2ss" path="res://entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd" id="1_t4vnu"] +[ext_resource type="Texture2D" uid="uid://b1n8nad43usw4" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png" id="2_ny3sb"] +[ext_resource type="Texture2D" uid="uid://cqqlkm14lawpa" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png" id="3_bml32"] +[ext_resource type="Texture2D" uid="uid://c22re5wfsm1ax" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png" id="4_ob8kj"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_6utw7"] +radius = 48.0 + +[sub_resource type="Animation" id="Animation_gal8b"] +resource_name = "charged" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprites/Pannels:modulate") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0.033333335, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(0.42365062, 0.42365065, 0.42365062, 1), Color(1, 1, 1, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Sprites/Flair:modulate") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)] +} + +[sub_resource type="Animation" id="Animation_77hon"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprites/Pannels:modulate") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0.42352942, 0.42352942, 0.42352942, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Sprites/Flair:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_5vw1f"] +_data = { +&"RESET": SubResource("Animation_77hon"), +&"charged": SubResource("Animation_gal8b") +} + +[node name="SolarPannel" type="Area2D"] +script = ExtResource("1_t4vnu") +metadata/_custom_type_script = "uid://du7qppxobx5nd" + +[node name="Sprites" type="Node2D" parent="."] +position = Vector2(15.999999, -16.999998) +scale = Vector2(0.09, 0.09) + +[node name="Pannels" type="Sprite2D" parent="Sprites"] +modulate = Color(0.42352942, 0.42352942, 0.42352942, 1) +texture = ExtResource("2_ny3sb") + +[node name="Base" type="Sprite2D" parent="Sprites"] +unique_name_in_owner = true +texture = ExtResource("3_bml32") + +[node name="Flair" type="Sprite2D" parent="Sprites"] +modulate = Color(1, 1, 1, 0) +texture = ExtResource("4_ob8kj") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(6, -23) +shape = SubResource("CircleShape2D_6utw7") + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +unique_name_in_owner = true +libraries = { +&"": SubResource("AnimationLibrary_5vw1f") +} diff --git a/entities/objectives/scripts/rewards/loot_random_seeds_reward.gd b/entities/objectives/scripts/rewards/loot_random_seeds_reward.gd index 989a41a..a57b90a 100644 --- a/entities/objectives/scripts/rewards/loot_random_seeds_reward.gd +++ b/entities/objectives/scripts/rewards/loot_random_seeds_reward.gd @@ -20,7 +20,7 @@ func get_description() -> String: func reward(objective : Objective): for i in range(seeds_number): objective.planet.drop_item( - Seed.new(GameInfo.game_data.unlocked_plant_types_path.pick_random()), + Seed.new(GameInfo.game_data.unlocked_plant_types.pick_random()), objective.global_position, REWARD_SEED_RANDOM_DISPLACEMENT_FACTOR ) \ No newline at end of file diff --git a/entities/plants/resources/plant_types/champ.tres b/entities/plants/resources/plant_types/champ.tres index 7609a77..35c7fde 100644 --- a/entities/plants/resources/plant_types/champ.tres +++ b/entities/plants/resources/plant_types/champ.tres @@ -9,7 +9,6 @@ [sub_resource type="Resource" id="Resource_5hyy8"] script = ExtResource("1_cf34j") produce_types_path = Array[String](["uid://cxrc5wchpqm18", "uid://b04vho33bl52b", "uid://dsctivn1vrem2", "uid://b04vho33bl52b"]) -produce_number = Array[int]([1, 2]) metadata/_custom_type_script = "uid://ceqx5va1ormau" [sub_resource type="AtlasTexture" id="AtlasTexture_my6by"] @@ -19,7 +18,7 @@ region = Rect2(610, 315, 124, 180) [resource] script = ExtResource("1_ipcpv") name = "Champ" -description = "When mature, produce seeds every day." +description = "When mature, produce one seed every day." growing_time = 1 seed_texture = SubResource("AtlasTexture_my6by") growing_texture = ExtResource("2_l2hi3") diff --git a/entities/player/scripts/player.gd b/entities/player/scripts/player.gd index 9b88c3f..b9a29e3 100644 --- a/entities/player/scripts/player.gd +++ b/entities/player/scripts/player.gd @@ -124,18 +124,20 @@ func try_move(move_to : Vector2): instruction = MoveInstruction.new(move_to) func pick_item(item : Item) -> Item: - inventory.add_item(item) - var currentItem : Item = inventory.get_item() - var itemSwapped : bool = false play_sfx("pick") - if !itemSwapped: - currentItem = null - return currentItem + if inventory.length() >= inventory.size: + var currentItem : Item = inventory.get_item() + inventory.set_item(item, inventory.current_item_ind) + return currentItem + else : + inventory.add_item(item) + return null func drop_item(): var item_to_drop = inventory.pop_item() - planet.drop_item(item_to_drop, global_position) - play_sfx("drop") + if item_to_drop: + planet.drop_item(item_to_drop, global_position) + play_sfx("drop") func delete_item(item: Item): inventory.remove_item(item) diff --git a/entities/underground_loot/scripts/underground_loot.gd b/entities/underground_loot/scripts/underground_loot.gd index 5df0700..49b32f8 100644 --- a/entities/underground_loot/scripts/underground_loot.gd +++ b/entities/underground_loot/scripts/underground_loot.gd @@ -2,7 +2,7 @@ extends InspectableEntity class_name UndergroundLoot const AREA_WIDTH = 20 -const LOOTED_ITEM_RANDOM_RANGE = 100 +const LOOTED_ITEM_RANDOM_RANGE = 50 const SPRITE_SCENE : PackedScene = preload("res://entities/underground_loot/underground_loot_sprite.tscn") @@ -43,15 +43,5 @@ func generate_collision_shape() -> CollisionShape2D: func dig(): for item in loot: - var item_object = planet.drop_item(item, global_position) - var tween : Tween = get_tree().create_tween() - tween.tween_property( - item_object, - "position", - Vector2( - item_object.position.x + randi()%LOOTED_ITEM_RANDOM_RANGE, - item_object.position.y + randi()%LOOTED_ITEM_RANDOM_RANGE - ), - 0.2 - ) + planet.drop_item(item, global_position, LOOTED_ITEM_RANDOM_RANGE) queue_free() diff --git a/gui/game/announce/announce.tscn b/gui/game/announce/announce.tscn index 660e128..7ed4b5e 100644 --- a/gui/game/announce/announce.tscn +++ b/gui/game/announce/announce.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=11 format=3 uid="uid://fnv0qhkh40mv"] +[gd_scene load_steps=12 format=3 uid="uid://fnv0qhkh40mv"] [ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_0ssee"] [ext_resource type="Script" uid="uid://bvb4v66bqteuc" path="res://gui/game/announce/scripts/announce.gd" id="1_4evne"] [ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="2_yrhd4"] [ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="3_7nrno"] +[ext_resource type="AudioStream" uid="uid://dxu6yqmaxxmmc" path="res://gui/game/announce/assets/sfx/alarm.wav" id="5_iwcrn"] [sub_resource type="LabelSettings" id="LabelSettings_vbart"] font = ExtResource("2_yrhd4") @@ -157,3 +158,8 @@ unique_name_in_owner = true libraries = { &"": SubResource("AnimationLibrary_dvva5") } + +[node name="Alarm" type="AudioStreamPlayer" parent="."] +unique_name_in_owner = true +stream = ExtResource("5_iwcrn") +pitch_scale = 2.0 diff --git a/gui/game/announce/assets/sfx/alarm.wav b/gui/game/announce/assets/sfx/alarm.wav new file mode 100644 index 0000000..c82a180 Binary files /dev/null and b/gui/game/announce/assets/sfx/alarm.wav differ diff --git a/gui/game/announce/assets/sfx/alarm.wav.import b/gui/game/announce/assets/sfx/alarm.wav.import new file mode 100644 index 0000000..c6b5ce2 --- /dev/null +++ b/gui/game/announce/assets/sfx/alarm.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://dxu6yqmaxxmmc" +path="res://.godot/imported/alarm.wav-e0f6b7b4874e69f8a83b072a97c636f4.sample" + +[deps] + +source_file="res://gui/game/announce/assets/sfx/alarm.wav" +dest_files=["res://.godot/imported/alarm.wav-e0f6b7b4874e69f8a83b072a97c636f4.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/gui/game/announce/assets/sfx/quota_announcement.wav b/gui/game/announce/assets/sfx/quota_announcement.wav new file mode 100644 index 0000000..596ebcf Binary files /dev/null and b/gui/game/announce/assets/sfx/quota_announcement.wav differ diff --git a/gui/game/announce/assets/sfx/quota_announcement.wav.import b/gui/game/announce/assets/sfx/quota_announcement.wav.import new file mode 100644 index 0000000..b0c8333 --- /dev/null +++ b/gui/game/announce/assets/sfx/quota_announcement.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://c5ccma3y6gqtw" +path="res://.godot/imported/quota_announcement.wav-ebdd79fb160b0596cac5cfcd6835a186.sample" + +[deps] + +source_file="res://gui/game/announce/assets/sfx/quota_announcement.wav" +dest_files=["res://.godot/imported/quota_announcement.wav-ebdd79fb160b0596cac5cfcd6835a186.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/gui/game/announce/scripts/announce.gd b/gui/game/announce/scripts/announce.gd index afa3112..5bb470d 100644 --- a/gui/game/announce/scripts/announce.gd +++ b/gui/game/announce/scripts/announce.gd @@ -9,3 +9,4 @@ func announce(title : String, text : String, band_color : Color = YELLOW_COLOR): %AnnounceText.text = text %AnnounceTexture.modulate = band_color %AnimationPlayer.play("pass") + %Alarm.play() diff --git a/gui/game/inventory_gui/inventory_item/scripts/inventory_gui_item.gd b/gui/game/inventory_gui/inventory_item/scripts/inventory_gui_item.gd index 6c5721c..b50d39e 100644 --- a/gui/game/inventory_gui/inventory_item/scripts/inventory_gui_item.gd +++ b/gui/game/inventory_gui/inventory_item/scripts/inventory_gui_item.gd @@ -40,7 +40,6 @@ func update(item: Item, selected : bool): if item != current_item: %SquishAnimation.play("squish") - print("squish") if item and item.icon: %TextureRect.texture = item.icon %TextureRect.visible = item != null diff --git a/gui/game/pause/pause.tscn b/gui/game/pause/pause.tscn index 9ff6d41..aa43908 100644 --- a/gui/game/pause/pause.tscn +++ b/gui/game/pause/pause.tscn @@ -131,9 +131,8 @@ horizontal_alignment = 1 layout_mode = 2 text = "You are a robot who has recently arrived on a barren planet. Find and plant seeds to reduce the contamination. You have limited energy, but can recharge when passing days. -You have 10 days to decontaminate as much as possible. -PS: You can compost seeds at the bottom of the map to upgrade max enegy. -" +Each 7 days, you have to meet a quota of decontaminted lands. +You get a machine to build each quota reached." horizontal_alignment = 1 [node name="ControlsTitle" type="Label" parent="Tutorial/VBoxContainer"] @@ -144,10 +143,10 @@ horizontal_alignment = 1 [node name="ControlsText" type="Label" parent="Tutorial/VBoxContainer"] layout_mode = 2 -text = "QWERTY/AZERTY/Directional Arrows : Move +text = "Directional Arrows/Right Click : Move Left Click : Interact/Pickup Items -Right Click/Space : Use Item -W : Drop Item +Mouse Wheel : Change current item +X : Drop Item " horizontal_alignment = 1 diff --git a/gui/game/tutorial/in_game_indicator/in_game_indicator.tscn b/gui/game/tutorial/in_game_indicator/in_game_indicator.tscn new file mode 100644 index 0000000..bcbc064 --- /dev/null +++ b/gui/game/tutorial/in_game_indicator/in_game_indicator.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=4 format=3 uid="uid://fh3dsuvn5h78"] + +[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_ga3ae"] +[ext_resource type="Texture2D" uid="uid://bsgmxvuphn73c" path="res://common/icons/arrow-narrow-down.svg" id="2_kc1j1"] +[ext_resource type="Script" uid="uid://r6hgefyycute" path="res://gui/game/tutorial/in_game_indicator/scripts/in_game_indicator.gd" id="2_kij5i"] + +[node name="InGameIndicator" type="CenterContainer"] +modulate = Color(0.91, 0.6521667, 0, 1) +offset_right = 150.0 +offset_bottom = 99.0 +size_flags_horizontal = 2 +size_flags_vertical = 2 +mouse_filter = 2 +theme = ExtResource("1_ga3ae") +script = ExtResource("2_kij5i") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 2 +theme = ExtResource("1_ga3ae") +theme_override_constants/separation = 0 + +[node name="Label" type="Label" parent="VBoxContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(150, 0) +layout_mode = 2 +text = "Text and a very very very long text" +horizontal_alignment = 1 +autowrap_mode = 3 + +[node name="Arrow" type="TextureRect" parent="VBoxContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(50, 50) +layout_mode = 2 +size_flags_horizontal = 4 +texture = ExtResource("2_kc1j1") +expand_mode = 1 +stretch_mode = 5 diff --git a/gui/game/tutorial/in_game_indicator/in_game_indicator.tscn15286367050.tmp b/gui/game/tutorial/in_game_indicator/in_game_indicator.tscn15286367050.tmp new file mode 100644 index 0000000..8014109 --- /dev/null +++ b/gui/game/tutorial/in_game_indicator/in_game_indicator.tscn15286367050.tmp @@ -0,0 +1,47 @@ +[gd_scene load_steps=4 format=3 uid="uid://fh3dsuvn5h78"] + +[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_ga3ae"] +[ext_resource type="Texture2D" uid="uid://bsgmxvuphn73c" path="res://common/icons/arrow-narrow-down.svg" id="2_kc1j1"] +[ext_resource type="Script" uid="uid://r6hgefyycute" path="res://gui/game/tutorial/in_game_indicator/scripts/in_game_indicator.gd" id="2_kij5i"] + +[node name="InGameIndicator" type="Control"] +modulate = Color(0.91, 0.6521667, 0, 1) +layout_mode = 3 +anchors_preset = 0 +offset_right = 50.0 +offset_bottom = 73.0 +size_flags_horizontal = 0 +size_flags_vertical = 0 +mouse_filter = 2 +theme = ExtResource("1_ga3ae") +script = ExtResource("2_kij5i") +game_position = null + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -50.0 +offset_top = -64.5 +offset_bottom = 8.5 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("1_ga3ae") +theme_override_constants/separation = 0 + +[node name="Label" type="Label" parent="VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Text" +horizontal_alignment = 1 + +[node name="Arrow" type="TextureRect" parent="VBoxContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(50, 50) +layout_mode = 2 +texture = ExtResource("2_kc1j1") +expand_mode = 1 +stretch_mode = 5 diff --git a/gui/game/tutorial/in_game_indicator/scripts/in_game_indicator.gd b/gui/game/tutorial/in_game_indicator/scripts/in_game_indicator.gd new file mode 100644 index 0000000..fb9ffdb --- /dev/null +++ b/gui/game/tutorial/in_game_indicator/scripts/in_game_indicator.gd @@ -0,0 +1,68 @@ +extends Control +class_name InGameIndicator + +const UP_SHIFT = 70 +const SCREEN_MARGIN = 20 + +enum FollowingType {GAME_POS, SCREEN_POS, ENTITY} + +var following_type: FollowingType = FollowingType.SCREEN_POS +var following_game_position : Vector2 = Vector2() +var following_screen_position : Vector2 = Vector2() +var following_entity : Node2D = null + +@export var camera : Camera2D + +var arrow_up : Texture = preload("res://common/icons/arrow-narrow-up.svg") +var arrow_down : Texture = preload("res://common/icons/arrow-narrow-down.svg") +var arrow_right : Texture = preload("res://common/icons/arrow-narrow-right.svg") +var arrow_left : Texture = preload("res://common/icons/arrow-narrow-left.svg") + +func setup(_camera : Camera2D, text : String): + camera = _camera + %Label.text = text + +func follow_game_position(game_position : Vector2): + following_game_position = game_position + following_type = FollowingType.GAME_POS + +func follow_screen_position(screen_position : Vector2): + following_screen_position = screen_position + following_type = FollowingType.SCREEN_POS + +func follow_entity(entity : Node2D): + following_entity = entity + following_type = FollowingType.ENTITY + +func _process(_d): + if camera: + show() + var screen_size = get_viewport().get_visible_rect().size + + var abs_position : Vector2 = following_screen_position + if following_type == FollowingType.GAME_POS: + abs_position = following_game_position - camera.global_position + screen_size / 2 + Vector2.UP * UP_SHIFT - size/2 + elif following_type == FollowingType.ENTITY and following_entity: + abs_position = following_entity.global_position - camera.global_position + screen_size / 2 + Vector2.UP * UP_SHIFT - size/2 + + position = Vector2( + min(max(abs_position.x, SCREEN_MARGIN), screen_size.x - SCREEN_MARGIN), + min(max(abs_position.y, SCREEN_MARGIN), screen_size.y - SCREEN_MARGIN) + ) + + var arrow_texture : Texture = arrow_down + if abs_position.y < 0: + arrow_texture = arrow_up + if abs_position.x < 0 : + arrow_texture = arrow_left + if abs_position.x > screen_size.x : + arrow_texture = arrow_right + position.x -= size.x + if abs_position.y > screen_size.y : + arrow_texture = arrow_down + position.y -= size.y + + + %Arrow.texture = arrow_texture + else: + hide() diff --git a/gui/game/tutorial/in_game_indicator/scripts/in_game_indicator.gd.uid b/gui/game/tutorial/in_game_indicator/scripts/in_game_indicator.gd.uid new file mode 100644 index 0000000..2aecbe2 --- /dev/null +++ b/gui/game/tutorial/in_game_indicator/scripts/in_game_indicator.gd.uid @@ -0,0 +1 @@ +uid://r6hgefyycute diff --git a/gui/game/tutorial/scripts/tutorial.gd b/gui/game/tutorial/scripts/tutorial.gd new file mode 100644 index 0000000..379a118 --- /dev/null +++ b/gui/game/tutorial/scripts/tutorial.gd @@ -0,0 +1,169 @@ +extends Control +class_name Tutorial + +const INDICATOR_SCENE = preload("res://gui/game/tutorial/in_game_indicator/in_game_indicator.tscn") + +var indicators : Array[InGameIndicator] +@export var camera : Camera2D +@export var player : Player + +@onready var steps : Array[Step] = [ + TakeShovelStep.new(), + DigLootStep.new(), + TakeSeedStep.new(), + PlantSeedStep.new(), + RechargeStep.new(), + WaitMaturePlant.new(), + HarvestMaturePlant.new(), +] +var actual_step : Step = null : set = pass_to_step + +func _process(_d): + if not GameInfo.game_data.tutorial_done: + if not actual_step and len(steps): + destroy_indicators() + pass_to_step(steps.pop_front()) + + if player and actual_step and actual_step.is_step_over(player): + destroy_indicators() + if len(steps): + pass_to_step(steps.pop_front()) + else : + GameInfo.game_data.tutorial_done = true + +func destroy_indicators(): + for i in indicators: + i.queue_free() + indicators = [] + +func pass_to_step(new_step : Step): + actual_step = new_step + indicators = new_step.generate_indicators(camera, player) + for i in indicators: + add_child(i) + +class Step: + func generate_indicator(cam : Camera2D, text : String) -> InGameIndicator: + var new_indicator : InGameIndicator = INDICATOR_SCENE.instantiate() + new_indicator.setup( + cam, + text + ) + return new_indicator + + func generate_indicators(_cam : Camera2D, _player : Player) -> Array[InGameIndicator]: + return [] + + func is_step_over(p : Player) -> bool: + return true + +class TakeShovelStep extends Step: + func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]: + for entity in p.planet.entityContainer.get_children(): + if entity is ItemObject and entity.item is Shovel: + var indicator = generate_indicator(cam, "Take the Shovel") + indicator.follow_entity(entity) + return [ + indicator + ] + printerr("No Shovel found...") + return [] + + func is_step_over(p : Player) -> bool: + return p.inventory.length() > 0 + +class DigLootStep extends Step: + func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]: + var indicators : Array[InGameIndicator] = [] + for entity in p.planet.entityContainer.get_children(): + if entity is UndergroundLoot: + var indicator = generate_indicator(cam, "Dig Underground Loot") + indicator.follow_entity(entity) + indicators.append( + indicator + ) + return indicators + + func is_step_over(p : Player) -> bool: + for entity in p.planet.entityContainer.get_children(): + if entity is ItemObject and entity.item is Seed: + return true + return false + +class TakeSeedStep extends Step: + func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]: + var indicators : Array[InGameIndicator] = [] + for entity in p.planet.entityContainer.get_children(): + if entity is ItemObject and entity.item is Seed: + var indicator = generate_indicator(cam, "Take a seed") + indicator.follow_entity(entity) + indicators.append( + indicator + ) + return indicators + + func is_step_over(p : Player) -> bool: + for item in p.inventory.items: + if item is Seed: + return true + return false + +class PlantSeedStep extends Step: + func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]: + var indicator = generate_indicator(cam, "Plant the seed in decontamined zone") + indicator.follow_game_position(Vector2(60,60) + p.planet.entityContainer.global_position) + return [indicator] + + func is_step_over(p : Player) -> bool: + for entity in p.planet.entityContainer.get_children(): + if entity is Plant: + return true + return false + +class RechargeStep extends Step: + func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]: + for entity in p.planet.entityContainer.get_children(): + var indicator = generate_indicator(cam, "Recharge to pass days") + indicator.follow_entity(entity) + if entity is RechargeStation: + return [ + indicator + ] + printerr("No Recharge Station found...") + return [] + + func is_step_over(p : Player) -> bool: + return p.planet.day > 1 + +class WaitMaturePlant extends Step: + func generate_indicators(_cam : Camera2D, _p: Player) -> Array[InGameIndicator]: + return [] + + func is_step_over(p : Player) -> bool: + for entity in p.planet.entityContainer.get_children(): + if entity is Plant and entity.state == Plant.State.MATURE: + return true + return false + +class HarvestMaturePlant extends Step: + + var mature_plant_number : int = 0 + + func generate_indicators(cam : Camera2D, p: Player) -> Array[InGameIndicator]: + var indicators : Array[InGameIndicator] = [] + for entity in p.planet.entityContainer.get_children(): + if entity is Plant and entity.state == Plant.State.MATURE: + var indicator = generate_indicator(cam, "Harvest mature plants with shovel") + indicator.follow_entity(entity) + indicators.append( + indicator + ) + mature_plant_number += 1 + return indicators + + func is_step_over(p : Player) -> bool: + var actual_mature_plant_number = 0 + for entity in p.planet.entityContainer.get_children(): + if entity is Plant and entity.state == Plant.State.MATURE: + actual_mature_plant_number += 1 + return mature_plant_number != actual_mature_plant_number \ No newline at end of file diff --git a/gui/game/tutorial/scripts/tutorial.gd.uid b/gui/game/tutorial/scripts/tutorial.gd.uid new file mode 100644 index 0000000..d071256 --- /dev/null +++ b/gui/game/tutorial/scripts/tutorial.gd.uid @@ -0,0 +1 @@ +uid://beg7favg2ukbi diff --git a/gui/game/tutorial/tutorial.tscn b/gui/game/tutorial/tutorial.tscn new file mode 100644 index 0000000..63ed7cf --- /dev/null +++ b/gui/game/tutorial/tutorial.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=3 uid="uid://dt6mptqg80dew"] + +[ext_resource type="Script" uid="uid://beg7favg2ukbi" path="res://gui/game/tutorial/scripts/tutorial.gd" id="1_ie1q8"] + +[node name="Tutorial" type="Control"] +layout_mode = 3 +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 +script = ExtResource("1_ie1q8") diff --git a/project.godot b/project.godot index 6411424..239be9c 100644 --- a/project.godot +++ b/project.godot @@ -56,7 +56,7 @@ action={ } drop={ "deadzone": 0.2, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":120,"location":0,"echo":false,"script":null) ] } pause={ diff --git a/root.tscn b/root.tscn index 628b21d..bebea2f 100644 --- a/root.tscn +++ b/root.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://c54457tbocdwk" path="res://gui/menu/scripts/menu.gd" id="1_bf3um"] [ext_resource type="Texture2D" uid="uid://bnrjnvceprxfn" path="res://stages/terrain/planet/assets/textures/sol_gamejam_normal.png" id="2_huihk"] [ext_resource type="Texture2D" uid="uid://dcn4cq53h1qiy" path="res://stages/terrain/planet/resources/textures/sol_gamejam_fleurs_transp.png" id="3_tw3kd"] -[ext_resource type="Theme" uid="uid://ldxkd6wn5qu1" path="res://gui/ressources/default_theme.tres" id="4_gd4vy"] +[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="4_gd4vy"] [ext_resource type="Texture2D" uid="uid://nx4wxpr6mk8l" path="res://gui/menu/assets/texture/SeedingPlanetsLogo.png" id="5_qw60f"] [ext_resource type="Texture2D" uid="uid://03ijmo6xlytu" path="res://gui/menu/assets/texture/abre1glow.png" id="6_eji0w"] [ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="7_qwhpj"] @@ -110,7 +110,8 @@ horizontal_alignment = 1 [node name="ArtText" type="Label" parent="CanvasLayer/MarginContainer/GridContainer/Credits"] layout_mode = 2 -text = "Céline Ferrand / Lunarde +text = "Baptiste Pocard +Céline Ferrand / Lunarde Camille Fleury " horizontal_alignment = 1 diff --git a/stages/planet_run/planet_run.tscn b/stages/planet_run/planet_run.tscn index 8f59657..030d9ac 100644 --- a/stages/planet_run/planet_run.tscn +++ b/stages/planet_run/planet_run.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=12 format=3 uid="uid://d28cp7a21kwou"] +[gd_scene load_steps=13 format=3 uid="uid://d28cp7a21kwou"] [ext_resource type="PackedScene" uid="uid://12nak7amd1uq" path="res://gui/game/game_gui.tscn" id="1_yy1uy"] [ext_resource type="PackedScene" uid="uid://csiacsndm62ll" path="res://gui/game/pause/pause.tscn" id="2_bt4fd"] @@ -6,6 +6,7 @@ [ext_resource type="PackedScene" uid="uid://doxm7uab8i3tq" path="res://gui/game/reward_choice/reward_choice.tscn" id="4_fbkgs"] [ext_resource type="PackedScene" uid="uid://bgvbgeq46wee2" path="res://entities/player/player.tscn" id="4_g33f4"] [ext_resource type="Script" uid="uid://dedg615xudpoq" path="res://entities/interactables/item_object/script/item_object.gd" id="5_kgrdw"] +[ext_resource type="PackedScene" uid="uid://dt6mptqg80dew" path="res://gui/game/tutorial/tutorial.tscn" id="5_orelw"] [ext_resource type="Script" uid="uid://dya38x1h1uiyg" path="res://common/inventory/scripts/items/shovel.gd" id="7_fbkgs"] [ext_resource type="PackedScene" uid="uid://d324mlmgls4fs" path="res://entities/interactables/machines/recharge_station/recharge_station.tscn" id="7_h4bgy"] [ext_resource type="PackedScene" uid="uid://tsi5j1uxppa4" path="res://stages/terrain/planet/planet.tscn" id="8_t31p7"] @@ -31,6 +32,10 @@ z_index = 1000 [node name="Win" parent="CanvasLayer" instance=ExtResource("3_6guxm")] visible = false +[node name="Tutorial" parent="CanvasLayer" node_paths=PackedStringArray("camera", "player") instance=ExtResource("5_orelw")] +camera = NodePath("../../Camera") +player = NodePath("../../Entities/Player") + [node name="Entities" type="Node2D" parent="."] y_sort_enabled = true diff --git a/stages/terrain/planet/scripts/planet.gd b/stages/terrain/planet/scripts/planet.gd index eb7824f..7af2a65 100644 --- a/stages/terrain/planet/scripts/planet.gd +++ b/stages/terrain/planet/scripts/planet.gd @@ -46,6 +46,7 @@ var player : Player func _ready(): planet_data = GameInfo.game_data.current_planet_data if GameInfo.game_data.current_planet_data else PlanetData.new() + terrain_size = planet_data.base_size entityContainer.position = terrain_size/2 @@ -212,7 +213,7 @@ func generate_loot(number : int = loot_number.pick_random()): var loot = UndergroundLoot.new(self) for j in range(loot_item_number.pick_random()): loot.loot.append( - Seed.new(GameInfo.game_data.unlocked_plant_types_path.pick_random()) + Seed.new(GameInfo.game_data.unlocked_plant_types.pick_random()) ) add_entity(loot) @@ -268,10 +269,9 @@ func ask_quota_reward(): func generate_quota_reward() -> Item: var random_level = randi_range( max(planet_data.quota_number - 1, 1), - min(planet_data.quota_number + 1, Machine.MAX_MACHINE_LEVEL), + min(planet_data.quota_number, Machine.MAX_MACHINE_LEVEL), ) var random_machine_type = GameInfo.game_data.unlocked_machines.pick_random() - return Blueprint.new(random_machine_type, random_level)