inventaire de 3 items #52
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=28 format=3 uid="uid://12nak7amd1uq"]
|
||||
[gd_scene load_steps=30 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/ressources/default_theme.tres" id="2_nq5i2"]
|
||||
@@ -7,7 +7,9 @@
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="4_k4juk"]
|
||||
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="4_ujg5r"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3lff5fui1k0c" path="res://gui/game/inspector/inspector.tscn" id="6_dr1y2"]
|
||||
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/icons/shovel.svg" id="8_h6540"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5cuxgisrsfgt" path="res://common/icons/player-pause.svg" id="9_2wykm"]
|
||||
[ext_resource type="Texture2D" uid="uid://bupl1y0cfj21q" path="res://entities/plants/assets/sprites/chardi/mature.png" id="9_id0t5"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_id0t5"]
|
||||
interpolation_mode = 1
|
||||
@@ -375,6 +377,33 @@ focus_mode = 0
|
||||
mouse_filter = 1
|
||||
icon = ExtResource("9_2wykm")
|
||||
|
||||
[node name="Inventory" type="HBoxContainer" parent="MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="MarginContainer/Inventory"]
|
||||
modulate = Color(1, 0, 1, 1)
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("8_h6540")
|
||||
expand_mode = 3
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="MarginContainer/Inventory"]
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_k4juk")
|
||||
expand_mode = 3
|
||||
|
||||
[node name="TextureRect3" type="TextureRect" parent="MarginContainer/Inventory"]
|
||||
modulate = Color(1, 0.37254903, 0.101960786, 1)
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("9_id0t5")
|
||||
expand_mode = 3
|
||||
|
||||
[node name="PassDayFade" type="ColorRect" parent="."]
|
||||
physics_interpolation_mode = 0
|
||||
layout_mode = 1
|
||||
|
||||
@@ -10,6 +10,24 @@ 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
|
||||
|
||||
for i in player.inventory.max_items:
|
||||
var item : Item = player.inventory.get_item(i)
|
||||
if item:
|
||||
if %Inventory.get_child_count() <= i:
|
||||
var texture_rect = TextureRect.new()
|
||||
texture_rect.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
|
||||
%Inventory.add_child(texture_rect)
|
||||
%Inventory.get_child(i).texture = item.icon
|
||||
%Inventory.get_child(i).visible = true
|
||||
if i == player.inventory.current_item_ind:
|
||||
%Inventory.get_child(i).modulate = Color.WHITE
|
||||
else:
|
||||
%Inventory.get_child(i).modulate = Color.DARK_GRAY
|
||||
else:
|
||||
if %Inventory.get_child_count() > i:
|
||||
%Inventory.get_child(i).visible = false
|
||||
|
||||
|
||||
update_no_energy_left_info(player.energy)
|
||||
|
||||
func _on_planet_updated(planet:Planet):
|
||||
|
||||
Reference in New Issue
Block a user