From bd852b007cae9dc7a4b68f61351a1331319791ea Mon Sep 17 00:00:00 2001 From: Zacharie Guet Date: Thu, 21 Aug 2025 18:02:50 +0200 Subject: [PATCH] =?UTF-8?q?#44=20changement=20de=20la=20m=C3=A9thode=20d'i?= =?UTF-8?q?nteraction=20et=20d'utilisation=20du=20joueur=20pour=20une=20pl?= =?UTF-8?q?us=20grande=20libert=C3=A9=20de=20la=20souris?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/inventory/scripts/item.gd | 8 +- common/inventory/scripts/items/seed.gd | 13 ++- common/inventory/scripts/items/shovel.gd | 3 + common/inventory/scripts/tool_item.gd | 7 +- .../interactables/compost/scripts/compost.gd | 3 + .../item_object/script/item_object.gd | 3 + .../interactables/scripts/interactable.gd | 23 +++-- entities/plants/resources/plants/default.tres | 2 +- entities/player/scripts/action_area.gd | 31 +++--- entities/player/scripts/player.gd | 88 ++++++++++-------- entities/scripts/inspectable_entity.gd | 5 +- game.tscn | 1 + gui/game/game_gui.tscn | 78 ++++++---------- gui/game/pause/pause.tscn | 4 +- gui/game/scripts/game_gui.gd | 12 +-- gui/pointer/assets/icons/left_click.svg | 50 ++++++++++ .../assets/icons/left_click.svg.import | 37 ++++++++ gui/pointer/assets/icons/right_click.svg | 50 ++++++++++ .../assets/icons/right_click.svg.import | 37 ++++++++ gui/pointer/assets/sounds/click.wav | Bin 0 -> 25586 bytes gui/pointer/assets/sounds/click.wav.import | 24 +++++ gui/pointer/pointer.tscn | 51 ++++++++-- gui/pointer/scripts/pointer.gd | 46 ++++++++- project.godot | 3 +- 24 files changed, 433 insertions(+), 146 deletions(-) create mode 100644 gui/pointer/assets/icons/left_click.svg create mode 100644 gui/pointer/assets/icons/left_click.svg.import create mode 100644 gui/pointer/assets/icons/right_click.svg create mode 100644 gui/pointer/assets/icons/right_click.svg.import create mode 100644 gui/pointer/assets/sounds/click.wav create mode 100644 gui/pointer/assets/sounds/click.wav.import diff --git a/common/inventory/scripts/item.gd b/common/inventory/scripts/item.gd index 0842e2b..6c956de 100644 --- a/common/inventory/scripts/item.gd +++ b/common/inventory/scripts/item.gd @@ -11,8 +11,14 @@ func is_one_time_use(): func can_use(_player : Player) -> bool: return false +func use_text(_player) -> String: + return "" + func use_requirement_text() -> String: return "" func use(_player : Player): - return false \ No newline at end of file + return false + +func generate_action_area(_player) -> ActionArea: + return null diff --git a/common/inventory/scripts/items/seed.gd b/common/inventory/scripts/items/seed.gd index 3d065ca..6feea97 100644 --- a/common/inventory/scripts/items/seed.gd +++ b/common/inventory/scripts/items/seed.gd @@ -13,14 +13,23 @@ class_name Seed func _init(_plant_type : PlantType = null): plant_type = _plant_type +func generate_action_area(player : Player) -> ActionArea: + return ActionArea.new( + player, + 10 + ) + +func use_text(_player) -> String: + return "Plant " + plant_type.name + func is_one_time_use(): return true func can_use(player : Player) -> bool: - return not player.planet.is_there_contamination(player.global_position) + return not player.planet.is_there_contamination(player.action_area.global_position) func use(player : Player) -> bool: if not can_use(player): return false player.play_sfx("dig") - return player.planet.plant(plant_type, player.global_position) + return player.planet.plant(plant_type, player.action_area.global_position) diff --git a/common/inventory/scripts/items/shovel.gd b/common/inventory/scripts/items/shovel.gd index ba6089e..51cfff7 100644 --- a/common/inventory/scripts/items/shovel.gd +++ b/common/inventory/scripts/items/shovel.gd @@ -3,6 +3,9 @@ class_name Shovel const USE_INTERVAL = 0.15 +func use_text(_player) -> String: + return "Dig" + func can_use(player : Player) -> bool: var areas = player.action_area.get_overlapping_areas() for area in areas : diff --git a/common/inventory/scripts/tool_item.gd b/common/inventory/scripts/tool_item.gd index 5a9ab3f..6184131 100644 --- a/common/inventory/scripts/tool_item.gd +++ b/common/inventory/scripts/tool_item.gd @@ -2,10 +2,9 @@ extends Item class_name ToolItem @export var area_width: float = 50 -@export var area_distance: float = 50 -func generate_action_area(): +func generate_action_area(player : Player) -> ActionArea: return ActionArea.new( - area_width, - area_distance + player, + area_width ) \ No newline at end of file diff --git a/entities/interactables/compost/scripts/compost.gd b/entities/interactables/compost/scripts/compost.gd index 22c389d..c07d57a 100644 --- a/entities/interactables/compost/scripts/compost.gd +++ b/entities/interactables/compost/scripts/compost.gd @@ -12,6 +12,9 @@ func _process(_delta): func inspected_text(): return "Compost" +func interact_text(): + return "Put a seed" + func can_interact(p : Player) -> bool: return p.inventory.get_item() and p.inventory.get_item() is Seed diff --git a/entities/interactables/item_object/script/item_object.gd b/entities/interactables/item_object/script/item_object.gd index 7898f7c..340bf19 100644 --- a/entities/interactables/item_object/script/item_object.gd +++ b/entities/interactables/item_object/script/item_object.gd @@ -24,6 +24,9 @@ func _ready(): func inspected_text(): return item.name + (" Seed" if item is Seed else "") +func interact_text(): + return "Take" + func interact(player : Player) -> bool: var swapped_item = player.inventory.get_item() diff --git a/entities/interactables/scripts/interactable.gd b/entities/interactables/scripts/interactable.gd index 69dc33c..60eb75b 100644 --- a/entities/interactables/scripts/interactable.gd +++ b/entities/interactables/scripts/interactable.gd @@ -4,19 +4,22 @@ class_name Interactable var available : bool = true func can_interact(_p : Player) -> bool: - return true + return true func interact_requirement_text() -> String: - return "" + return "" -func interact(_p : Player) -> bool: - printerr("Interact function called on abstract Interactable class") - return false +func interact(_p : Player) -> bool: + printerr("Interact function called on abstract Interactable class") + return false func generate_collision(area_width : float): - var collision = CollisionShape2D.new() - var collision_shape = CircleShape2D.new() - collision_shape.radius = area_width + var collision = CollisionShape2D.new() + var collision_shape = CircleShape2D.new() + collision_shape.radius = area_width - collision.shape = collision_shape - add_child(collision) \ No newline at end of file + collision.shape = collision_shape + add_child(collision) + +func interact_text(): + return "" diff --git a/entities/plants/resources/plants/default.tres b/entities/plants/resources/plants/default.tres index 88c9a95..e204786 100644 --- a/entities/plants/resources/plants/default.tres +++ b/entities/plants/resources/plants/default.tres @@ -2,7 +2,7 @@ [ext_resource type="Texture2D" uid="uid://c7mp7tkkkk6o5" path="res://entities/plants/assets/sprites/default/growing.png" id="1_fp5j6"] [ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_moyj3"] -[ext_resource type="Script" uid="uid://cgscbuxe4dawb" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_cky1j"] +[ext_resource type="Script" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_cky1j"] [ext_resource type="Texture2D" uid="uid://bupl1y0cfj21q" path="res://entities/plants/assets/sprites/default/mature.png" id="3_ffarr"] [ext_resource type="Texture2D" uid="uid://ba413oun7ry78" path="res://entities/plants/assets/sprites/default/planted.png" id="4_2s6re"] [ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_cky1j"] diff --git a/entities/player/scripts/action_area.gd b/entities/player/scripts/action_area.gd index 25cfc81..9c4f267 100644 --- a/entities/player/scripts/action_area.gd +++ b/entities/player/scripts/action_area.gd @@ -1,44 +1,41 @@ extends Area2D class_name ActionArea -const OPACITY = 0.3 +const OPACITY = 0.4 const ACTIVATED_COLOR = Color.TURQUOISE const DEACTIVATED_COLOR = Color.REBECCA_PURPLE var collision_shape : CollisionShape2D = null -var area_width : float = 40 -var area_distance : float = 80 +var area_width : float +var area_max_distance : float +var player : Player -var activated : bool = false : - set(v): - var old = activated - activated = v - if old != activated: - queue_redraw() +var activated : bool = false func _init( + _player: Player, _area_width : float = 40, - _area_distance : float = 80 ): + player = _player area_width = _area_width - area_distance = _area_distance func _ready(): collision_shape = CollisionShape2D.new() - collision_shape.position.x = area_distance collision_shape.shape = CircleShape2D.new() collision_shape.shape.radius = area_width add_child(collision_shape) func _process(_delta): - look_at(get_global_mouse_position()) + var target_position = get_global_mouse_position() - player.global_position + if Vector2.ONE.distance_to(target_position) > player.max_reach: + target_position = Vector2.ZERO.direction_to(target_position)*player.max_reach + + position = target_position + queue_redraw() func _draw(): draw_circle( - Vector2( - area_distance, - 0 - ), + Vector2.ZERO, area_width, Color((ACTIVATED_COLOR if activated else DEACTIVATED_COLOR), OPACITY) ) diff --git a/entities/player/scripts/player.gd b/entities/player/scripts/player.gd index 018478b..a834871 100644 --- a/entities/player/scripts/player.gd +++ b/entities/player/scripts/player.gd @@ -1,8 +1,11 @@ extends CharacterBody2D class_name Player +const MAX_REACH_CIRCLE_OPACITY = 0.1 + signal player_updated(player: Player) signal action_tried_without_energy +signal action_not_permitted signal upgraded var planet : Planet # mis à jour par la classe Planet @@ -11,48 +14,47 @@ var planet : Planet # mis à jour par la classe Planet @onready var inventory : Inventory = Inventory.new() var max_energy : int = 3 +var max_reach : int = 100 : + set(v): + max_reach = v + queue_redraw() var controlling_player : bool = true : set(v): controlling_player = v velocity = Vector2.ZERO -var closest_interactable : Interactable = null : - set(v): - var old = closest_interactable - closest_interactable = v - if old != closest_interactable: - player_updated.emit(self) +var target_interactable : Interactable = null # mis à jour par la classe Interactable + var can_use_item : bool = false : set(v): var old = can_use_item can_use_item = v if old != can_use_item: - player_updated.emit(self) -var can_interact : bool = false : - set(v): - var old = can_interact - can_interact = v - if old != can_interact: + print("emit") player_updated.emit(self) var energy : int = max_energy : set(v): energy = v - emit_signal("player_updated", self) -var action_area : ActionArea = null + player_updated.emit(self) +var action_area : ActionArea = null : + set(v): + action_area = v + queue_redraw() func _ready(): - emit_signal("player_updated", self) + player_updated.emit(self) inventory.inventory_changed.connect(_on_inventory_updated) + Pointer.player = self # Méthode déclenchée par la classe planet func _pass_day(): energy = max_energy + target_interactable = null func _process(_delta): get_input() move_and_slide() - detect_closest_interactable() func _on_root_gui_day_pass_pressed(): controlling_player = false @@ -66,19 +68,33 @@ func _on_root_gui_game_click(): func _on_inventory_updated(_inventory: Inventory): emit_signal("player_updated", self) +func _draw(): + if action_area: + draw_arc( + Vector2.ZERO, + max_reach, + 0., + 2*PI, + 30, + Color(Color.WHITE,MAX_REACH_CIRCLE_OPACITY), + 1 + ) + func get_input(): if controlling_player: var old_velocity=velocity calculate_direction() can_use_item = inventory.get_item() and inventory.get_item().can_use(self) - can_interact = closest_interactable and closest_interactable.can_interact(self) if action_area: action_area.activated = can_use_item + if target_interactable and target_interactable in $InteractArea2D.get_overlapping_areas(): + if target_interactable.can_interact(self): + Pointer.stop_inspect_entity(target_interactable) + target_interactable.interact(self) + target_interactable = null if Input.is_action_just_pressed("action"): try_use_item() - if Input.is_action_just_pressed("interact") and closest_interactable and can_interact: - closest_interactable.interact(self) if Input.is_action_just_pressed("drop") and inventory.get_item(): drop_item() if old_velocity.length()==0 and velocity.length()!=0: @@ -86,21 +102,31 @@ func get_input(): func calculate_direction(): var input_direction: Vector2 = Input.get_vector("move_left", "move_right", "move_up", "move_down") + + if input_direction.length() != 0: + target_interactable = null + + if target_interactable: + input_direction = self.global_position.direction_to(target_interactable.global_position) + velocity = input_direction * speed if input_direction.x: $Sprite.flip_h = (input_direction.x < 0) func try_use_item(): - if energy == 0 and inventory.get_item(): + if energy == 0: action_tried_without_energy.emit() + elif not can_use_item: + action_not_permitted.emit() if energy > 0 and can_use_item: use_item() func get_item(item : Item): remove_action_area() inventory.set_item(item) - if item is ToolItem: - add_action_area(item.generate_action_area()) + var new_action_area = item.generate_action_area(self) + if new_action_area != null : + add_action_area(new_action_area) play_sfx("pick") func drop_item(): @@ -121,22 +147,6 @@ func use_item(): if item.is_one_time_use(): delete_item() -func detect_closest_interactable(): - var in_range_interactables : Array[Interactable] = [] - for area in $InteractArea2D.get_overlapping_areas(): - if area is Interactable and area.available: - in_range_interactables.append(area) - - in_range_interactables.sort_custom( - func(a : Node2D, b : Node2D) : - return a.global_position.distance_to(global_position) < b.global_position.distance_to(global_position) - ) - - if len(in_range_interactables) > 0: - closest_interactable = in_range_interactables[0] - else : - closest_interactable = null - func add_action_area(area : ActionArea): action_area = area add_child(action_area) @@ -144,6 +154,8 @@ func add_action_area(area : ActionArea): func remove_action_area(): if (action_area): remove_child(action_area) + action_area.queue_free() + action_area = null func upgrade(): max_energy += 1 diff --git a/entities/scripts/inspectable_entity.gd b/entities/scripts/inspectable_entity.gd index 4d3ca2d..8a5fbd0 100644 --- a/entities/scripts/inspectable_entity.gd +++ b/entities/scripts/inspectable_entity.gd @@ -4,15 +4,14 @@ class_name InspectableEntity const MODULATE_INSPECTED_COLOR = Color.GRAY @onready var default_modulate : Color = modulate -@onready var mouse_signals_setuped : bool = setup_mouse_signals() +@onready var inspectable_signals_setuped : bool = setup_inspectable_signals() var inspected : bool = false : set(v): - print(v) inspected = v modulate = MODULATE_INSPECTED_COLOR if inspected else default_modulate -func setup_mouse_signals() -> bool: +func setup_inspectable_signals() -> bool: mouse_entered.connect(_on_mouse_entered) mouse_exited.connect(_on_mouse_excited) return true diff --git a/game.tscn b/game.tscn index d36f919..b81f209 100644 --- a/game.tscn +++ b/game.tscn @@ -90,6 +90,7 @@ following = NodePath("../Entities/Player") [connection signal="day_pass_proceed" from="CanvasLayer/RootGui" to="Planet" method="_on_root_gui_day_pass_proceed"] [connection signal="game_click" from="CanvasLayer/RootGui" to="Entities/Player" method="_on_root_gui_game_click"] [connection signal="pause_asked" from="CanvasLayer/RootGui" to="CanvasLayer/Pause" method="_on_root_gui_pause_asked"] +[connection signal="action_not_permitted" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_action_not_permitted"] [connection signal="action_tried_without_energy" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_action_tried_without_energy"] [connection signal="player_updated" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_updated"] [connection signal="upgraded" from="Entities/Player" to="CanvasLayer/RootGui" method="_on_player_upgraded"] diff --git a/gui/game/game_gui.tscn b/gui/game/game_gui.tscn index 8b7fa7f..572e5c6 100644 --- a/gui/game/game_gui.tscn +++ b/gui/game/game_gui.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=21 format=3 uid="uid://12nak7amd1uq"] +[gd_scene load_steps=22 format=3 uid="uid://12nak7amd1uq"] [ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/game/scripts/game_gui.gd" id="1_udau0"] [ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/game/ressources/default_theme.tres" id="2_nq5i2"] @@ -136,6 +136,34 @@ tracks/2/keys = { "values": [Color(0.866667, 0.152941, 0.337255, 0), Color(0.866667, 0.152941, 0.337255, 0.392157), Color(0.866667, 0.152941, 0.337255, 0)] } +[sub_resource type="Animation" id="Animation_id0t5"] +resource_name = "not_permitted" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Effect:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 1, +"values": [true, false] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Effect:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.1, 0.266667), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Color(0.866667, 0.152941, 0.337255, 0), Color(0.866667, 0.152941, 0.337255, 0.392157), Color(0.866667, 0.152941, 0.337255, 0)] +} + [sub_resource type="Animation" id="Animation_k4juk"] resource_name = "recharge_fade_in" tracks/0/type = "value" @@ -234,6 +262,7 @@ tracks/2/keys = { _data = { &"RESET": SubResource("Animation_iyvkh"), &"no_energy_left": SubResource("Animation_n4kem"), +&"not_permitted": SubResource("Animation_id0t5"), &"recharge_fade_in": SubResource("Animation_k4juk"), &"recharge_fade_out": SubResource("Animation_fovlv"), &"upgrade": SubResource("Animation_2wykm") @@ -260,15 +289,6 @@ size_flags_vertical = 3 mouse_filter = 1 script = ExtResource("1_udau0") -[node name="GameAction" type="TextureButton" parent="."] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 1 - [node name="MarginContainer" type="MarginContainer" parent="."] layout_mode = 1 anchors_preset = 15 @@ -401,43 +421,6 @@ label_settings = SubResource("LabelSettings_n4kem") autowrap_mode = 3 clip_text = true -[node name="AvailableActions" type="HBoxContainer" parent="MarginContainer"] -unique_name_in_owner = true -layout_mode = 2 -size_flags_horizontal = 4 -size_flags_vertical = 8 -theme = ExtResource("2_nq5i2") - -[node name="Plant" type="Label" parent="MarginContainer/AvailableActions"] -visible = false -layout_mode = 2 -text = "Space/Click - Plant Seed" - -[node name="Interact" type="Label" parent="MarginContainer/AvailableActions"] -visible = false -layout_mode = 2 -text = "E - Interact" - -[node name="GetItem" type="Label" parent="MarginContainer/AvailableActions"] -visible = false -layout_mode = 2 -text = "E - Take Item" - -[node name="SwapItem" type="Label" parent="MarginContainer/AvailableActions"] -visible = false -layout_mode = 2 -text = "E - Swap Item" - -[node name="DropItem" type="Label" parent="MarginContainer/AvailableActions"] -visible = false -layout_mode = 2 -text = "W - Drop Item" - -[node name="UseItem" type="Label" parent="MarginContainer/AvailableActions"] -visible = false -layout_mode = 2 -text = "Space/Click - Use Item" - [node name="TopRightContent" type="HBoxContainer" parent="MarginContainer"] layout_mode = 2 size_flags_horizontal = 8 @@ -493,6 +476,5 @@ grow_vertical = 2 mouse_filter = 2 texture = SubResource("GradientTexture2D_id0t5") -[connection signal="button_down" from="GameAction" to="." method="_on_game_action_button_down"] [connection signal="pressed" from="MarginContainer/DayPass" to="." method="_on_day_pass_pressed"] [connection signal="pressed" from="MarginContainer/TopRightContent/Pause" to="." method="_on_pause_pressed"] diff --git a/gui/game/pause/pause.tscn b/gui/game/pause/pause.tscn index 2723d62..c6d16d2 100644 --- a/gui/game/pause/pause.tscn +++ b/gui/game/pause/pause.tscn @@ -76,8 +76,8 @@ horizontal_alignment = 1 [node name="ControlsText" type="Label" parent="Tutorial/VBoxContainer"] layout_mode = 2 text = "QWERTY/AZERTY/Directional Arrows : Move -E : Interact/Pickup Items -Space/Click : Use Item +Left Click : Interact/Pickup Items +Right Click/Space : Use Item W : Drop Item " horizontal_alignment = 1 diff --git a/gui/game/scripts/game_gui.gd b/gui/game/scripts/game_gui.gd index e650e77..4877df7 100644 --- a/gui/game/scripts/game_gui.gd +++ b/gui/game/scripts/game_gui.gd @@ -11,14 +11,6 @@ func _on_player_updated(player:Player): %EnergyCount.text = str(player.energy) + "/" + str(player.max_energy) %EnergyInfo.modulate = Color.WHITE if player.energy > 0 else Color.RED - %AvailableActions/GetItem.visible = player.closest_interactable is ItemObject and player.inventory.get_item() == null - %AvailableActions/Interact.visible = not player.closest_interactable is ItemObject and player.can_interact - %AvailableActions/SwapItem.visible = player.closest_interactable is ItemObject and player.inventory.get_item() != null - %AvailableActions/DropItem.visible = player.inventory.get_item() != null - %AvailableActions/UseItem.visible = player.inventory.get_item() and player.can_use_item and not player.inventory.get_item() is Seed - %AvailableActions/Plant.visible = player.inventory.get_item() and player.can_use_item and player.inventory.get_item() is Seed - - %ItemInfo.visible = player.inventory.get_item() != null if player.inventory.get_item(): var item : Item = player.inventory.get_item() @@ -53,3 +45,7 @@ func _on_pause_pressed(): func _on_player_upgraded(): $AnimationPlayer.play("upgrade") + + +func _on_player_action_not_permitted(): + $AnimationPlayer.play("not_permitted") diff --git a/gui/pointer/assets/icons/left_click.svg b/gui/pointer/assets/icons/left_click.svg new file mode 100644 index 0000000..557a1e1 --- /dev/null +++ b/gui/pointer/assets/icons/left_click.svg @@ -0,0 +1,50 @@ + + + + + + + diff --git a/gui/pointer/assets/icons/left_click.svg.import b/gui/pointer/assets/icons/left_click.svg.import new file mode 100644 index 0000000..2963be5 --- /dev/null +++ b/gui/pointer/assets/icons/left_click.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://djb52fosgmv4j" +path="res://.godot/imported/left_click.svg-163ab642e0d1ce655b5b40384b3f1392.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://gui/pointer/assets/icons/left_click.svg" +dest_files=["res://.godot/imported/left_click.svg-163ab642e0d1ce655b5b40384b3f1392.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/gui/pointer/assets/icons/right_click.svg b/gui/pointer/assets/icons/right_click.svg new file mode 100644 index 0000000..ca84e04 --- /dev/null +++ b/gui/pointer/assets/icons/right_click.svg @@ -0,0 +1,50 @@ + + + + + + + diff --git a/gui/pointer/assets/icons/right_click.svg.import b/gui/pointer/assets/icons/right_click.svg.import new file mode 100644 index 0000000..2c0c48e --- /dev/null +++ b/gui/pointer/assets/icons/right_click.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://y3083o1fhgn0" +path="res://.godot/imported/right_click.svg-89ed358ede3244ca5dababdd0f091dae.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://gui/pointer/assets/icons/right_click.svg" +dest_files=["res://.godot/imported/right_click.svg-89ed358ede3244ca5dababdd0f091dae.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/gui/pointer/assets/sounds/click.wav b/gui/pointer/assets/sounds/click.wav new file mode 100644 index 0000000000000000000000000000000000000000..8f57211c480ca843604516957b2c59b1416c792f GIT binary patch literal 25586 zcmY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!ad@>|#@9R;}61p@zv1taXzOxOQ5KS6Dq}1)FPRorLIOMV*}4 zB>KG;To=877-rR!Iwu>iiGIrmpNQew*;8h=L&Q>(+($5$vD(b|PE4})%O||Z8?52e zfBA+D&Pxjt{~UoQL-=8O0+B-vP&2eF zk-%Jq5uB^$2sw8fDFc0qC-j)v@^lmR$$Q8H^jTK*StZW7=Fc4sPZ99R5lYUwG#0wEk^xvDCyE&Fhy=!Eu9|rTM`o{tKF&S}$LDXUNot~5m(MdU5vPLE$UXpm3vW{5m!P{mg`C&D#3Ln zPgFtIm7-B4U02FRRd8LY8dbw}<+-Q^t}D%=UUFS&AJx@$rDs$>*Oj-UM!T-O-G5NO zXKBFb&zY}UR?h!zUbO%3-yQRXUD5xhn*Y;||Nd*ytWDcu`n_4J#xFK&)3|Le{oc4m SsWwB0_2@gWRJE#>_5T2x`>~_| literal 0 HcmV?d00001 diff --git a/gui/pointer/assets/sounds/click.wav.import b/gui/pointer/assets/sounds/click.wav.import new file mode 100644 index 0000000..04d84b3 --- /dev/null +++ b/gui/pointer/assets/sounds/click.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bym03qp4n6vep" +path="res://.godot/imported/click.wav-fdd6eee7149fdb4e39d8aa55063ce4ff.sample" + +[deps] + +source_file="res://gui/pointer/assets/sounds/click.wav" +dest_files=["res://.godot/imported/click.wav-fdd6eee7149fdb4e39d8aa55063ce4ff.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/pointer/pointer.tscn b/gui/pointer/pointer.tscn index 7d27114..2d24ba2 100644 --- a/gui/pointer/pointer.tscn +++ b/gui/pointer/pointer.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=4 format=3 uid="uid://0yr6b2jtuttm"] +[gd_scene load_steps=6 format=3 uid="uid://0yr6b2jtuttm"] [ext_resource type="Script" uid="uid://vhumsfntpqcl" path="res://gui/pointer/scripts/pointer.gd" id="1_1pe2k"] [ext_resource type="Texture2D" uid="uid://bspffyprdywgc" path="res://gui/pointer/assets/cursors/pointer.svg" id="2_q4bvb"] [ext_resource type="AudioStream" uid="uid://bym03qp4n6vep" path="res://gui/pointer/assets/sounds/click.wav" id="3_kj0cm"] +[ext_resource type="Texture2D" uid="uid://djb52fosgmv4j" path="res://gui/pointer/assets/icons/left_click.svg" id="3_pshoq"] +[ext_resource type="Texture2D" uid="uid://y3083o1fhgn0" path="res://gui/pointer/assets/icons/right_click.svg" id="4_b4uwv"] [node name="Pointer" type="Node"] process_mode = 3 @@ -18,17 +20,54 @@ layout_mode = 3 anchors_preset = 0 offset_right = 40.0 offset_bottom = 40.0 +mouse_filter = 2 + +[node name="Container" type="VBoxContainer" parent="CanvasLayer/Inspector"] +layout_mode = 0 +offset_left = 40.0 +offset_right = 137.0 +offset_bottom = 79.0 size_flags_horizontal = 0 size_flags_vertical = 0 mouse_filter = 2 -[node name="InspectorText" type="Label" parent="CanvasLayer/Inspector"] +[node name="InspectorText" type="Label" parent="CanvasLayer/Inspector/Container"] unique_name_in_owner = true z_index = 1 -layout_mode = 1 -offset_left = 26.0 -offset_right = 66.0 -offset_bottom = 23.0 +layout_mode = 2 +text = "Item" + +[node name="Interact" type="HBoxContainer" parent="CanvasLayer/Inspector/Container"] +unique_name_in_owner = true +modulate = Color(1, 1, 0.168627, 1) +layout_mode = 2 + +[node name="TextureRect" type="TextureRect" parent="CanvasLayer/Inspector/Container/Interact"] +layout_mode = 2 +texture = ExtResource("3_pshoq") + +[node name="InspectorInteractionText" type="Label" parent="CanvasLayer/Inspector/Container/Interact"] +unique_name_in_owner = true +z_index = 1 +layout_mode = 2 +text = "Take" +horizontal_alignment = 1 + +[node name="Use" type="HBoxContainer" parent="CanvasLayer/Inspector/Container"] +unique_name_in_owner = true +modulate = Color(1, 1, 0.168627, 1) +layout_mode = 2 + +[node name="TextureRect" type="TextureRect" parent="CanvasLayer/Inspector/Container/Use"] +layout_mode = 2 +texture = ExtResource("4_b4uwv") + +[node name="InspectorUseText" type="Label" parent="CanvasLayer/Inspector/Container/Use"] +unique_name_in_owner = true +z_index = 1 +layout_mode = 2 +text = "Gloubi" +horizontal_alignment = 1 [node name="Audio" type="Node" parent="."] diff --git a/gui/pointer/scripts/pointer.gd b/gui/pointer/scripts/pointer.gd index 572cefe..be01ea8 100644 --- a/gui/pointer/scripts/pointer.gd +++ b/gui/pointer/scripts/pointer.gd @@ -3,14 +3,32 @@ extends Node @export var default_cursor : Texture2D var inspected_entity : InspectableEntity = null -var player : Player # renseigné par Player +var player : Player :# renseigné par Player + set(v): + # if player: + # player.player_updated.disconnect(update_inspector) + player = v + player.player_updated.connect( + func(p): update_inspector() + ) func _ready(): Input.set_custom_mouse_cursor(default_cursor) + %InspectorText.visible = false + %Interact.visible = false + %Use.visible = false func _input(_event): if Input.is_action_just_pressed("interact"): $Audio/Click.play() + if ( + player != null + and inspected_entity + and inspected_entity is Interactable + ): + var interactable = inspected_entity as Interactable + if interactable.can_interact(player): + player.target_interactable = interactable func _process(_delta): %Inspector.position = get_viewport().get_mouse_position() @@ -18,14 +36,32 @@ func _process(_delta): func inspect_entity(entity : InspectableEntity): if inspected_entity and inspected_entity != entity: inspected_entity.inspected = false - %InspectorText.text = entity.inspected_text() - %InspectorText.visible = true inspected_entity = entity inspected_entity.inspected = true + update_inspector() + +func update_inspector(): + print("updated") + + %InspectorText.visible = inspected_entity != null + if inspected_entity: + %InspectorText.text = inspected_entity.inspected_text() + + if player: + %Interact.visible = inspected_entity and inspected_entity is Interactable and inspected_entity.can_interact(player) + if inspected_entity and inspected_entity is Interactable and inspected_entity.can_interact(player): + %InspectorInteractionText.text = inspected_entity.interact_text() + + %Use.visible = player.can_use_item + if player.inventory.get_item() and player.can_use_item: + %InspectorUseText.text = player.inventory.get_item().use_text(player) + else: + %Interact.visible = false + %Use.visible = false + func stop_inspect_entity(entity : InspectableEntity): entity.inspected = false if inspected_entity == entity: - %InspectorText.visible = false inspected_entity = null - + update_inspector() diff --git a/project.godot b/project.godot index a5943fa..61f7fe9 100644 --- a/project.godot +++ b/project.godot @@ -50,12 +50,13 @@ move_down={ } interact={ "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":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null) +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(190, 22),"global_position":Vector2(199, 70),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) ] } action={ "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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) +, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(76, 12),"global_position":Vector2(85, 60),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null) ] } drop={