ajouts d'objectifs sur la carte, déplacements des icônes et divers changements
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://bkwh1ntvgkkrt"]
|
||||
[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"]
|
||||
|
||||
[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)
|
||||
@@ -95,14 +99,14 @@ _data = {
|
||||
&"fill": SubResource("Animation_etofw")
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_akkx7"]
|
||||
size = Vector2(66, 84)
|
||||
|
||||
[node name="Compost" type="Area2D"]
|
||||
script = ExtResource("1_c0pig")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_akkx7")
|
||||
|
||||
[node name="Compost" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.615686, 0.501961, 0.270588, 1)
|
||||
self_modulate = Color(0.729698, 0.588265, 0.105405, 1)
|
||||
scale = Vector2(0.291262, 0.291262)
|
||||
texture = ExtResource("2_r6435")
|
||||
|
||||
@@ -117,10 +121,13 @@ theme_override_styles/fill = SubResource("StyleBoxFlat_3ao1n")
|
||||
fill_mode = 3
|
||||
show_percentage = false
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="Compost"]
|
||||
z_index = 1
|
||||
position = Vector2(0, 54.9334)
|
||||
scale = Vector2(2.00278, 2.00278)
|
||||
texture = ExtResource("3_akkx7")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_etofw")
|
||||
}
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_akkx7")
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
extends Machine
|
||||
class_name Compost
|
||||
|
||||
var value_per_seed : float = 0.5
|
||||
var fill_value : float = 0.
|
||||
@export var seed_needed : int = 2
|
||||
@export var energy_production : int = 1
|
||||
var containing_seed : int = 0
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
%ProgressBar.value = lerp(%ProgressBar.value, fill_value * 100, 0.5)
|
||||
%ProgressBar.value = lerp(%ProgressBar.value, float(containing_seed) / float(seed_needed) * 100, 0.5)
|
||||
|
||||
func pointer_text():
|
||||
return "Compost"
|
||||
|
||||
func interact_text():
|
||||
return "Put a seed ("+str(roundi((1-fill_value)/value_per_seed))+" left)"
|
||||
return "Put a seed ("+str(seed_needed - containing_seed)+" left)"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
"The compost allow you to upgrade your max energy when putting in it a certain amount of seeds."
|
||||
"The compost allow you to generate one energy for " + str(seed_needed) + " seeds."
|
||||
)
|
||||
|
||||
func can_interact(p : Player) -> bool:
|
||||
@@ -31,12 +33,11 @@ func interact(p : Player) -> bool:
|
||||
|
||||
p.play_sfx("harvest")
|
||||
p.delete_item(p.inventory.get_item())
|
||||
fill_value += value_per_seed
|
||||
if fill_value >= 1.:
|
||||
containing_seed += 1
|
||||
if containing_seed >= seed_needed:
|
||||
$AnimationPlayer.play("empty")
|
||||
fill_value = 0
|
||||
p.upgrade()
|
||||
value_per_seed /= 1.5
|
||||
containing_seed = 0
|
||||
p.recharge(energy_production)
|
||||
else:
|
||||
$AnimationPlayer.play("fill")
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user