ajouts d'objectifs sur la carte, déplacements des icônes et divers changements
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bcj812ox8xv2t"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://reliyx2pg7kf" path="res://entities/interactables/item_object/script/item_object_sprite.gd" id="1_wing4"]
|
||||
[ext_resource type="Texture2D" uid="uid://bo3o2qf3i20ke" path="res://common/inventory/assets/icons/scuba-diving-tank.svg" id="2_ng3e4"]
|
||||
[ext_resource type="Texture2D" uid="uid://bo3o2qf3i20ke" path="res://common/icons/scuba-diving-tank.svg" id="2_ng3e4"]
|
||||
[ext_resource type="Texture2D" uid="uid://c1eiu5ag7lcp8" path="res://entities/interactables/item_object/assets/sprites/shadow.svg" id="2_ng201"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wing4"]
|
||||
|
||||
@@ -68,9 +68,10 @@ func generate_sprite() -> ItemObjectSprite:
|
||||
var spriteNode = SPRITE_SCENE.instantiate() as ItemObjectSprite
|
||||
add_child(spriteNode)
|
||||
|
||||
spriteNode.apply_texture_to_sprite(
|
||||
item.icon,
|
||||
ITEM_SPRITE_SIZE
|
||||
)
|
||||
if item:
|
||||
spriteNode.apply_texture_to_sprite(
|
||||
item.icon,
|
||||
ITEM_SPRITE_SIZE
|
||||
)
|
||||
|
||||
return spriteNode
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,23 +1,29 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://d324mlmgls4fs"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://d324mlmgls4fs"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bsrn3gd2a532q" path="res://entities/interactables/machines/recharge_station/scripts/recharge_station.gd" id="1_2ffjo"]
|
||||
[ext_resource type="Texture2D" uid="uid://c82ljr3in67am" path="res://entities/interactables/machines/recharge_station/assets/sprites/recharge_station.svg" id="2_58ax0"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_3xua0"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bjhct"]
|
||||
radius = 15.0
|
||||
height = 72.0
|
||||
|
||||
[node name="RechargeStation" type="Area2D"]
|
||||
modulate = Color(0.615686, 0.501961, 0.270588, 1)
|
||||
script = ExtResource("1_2ffjo")
|
||||
metadata/_custom_type_script = "uid://dyprcd68fjstf"
|
||||
|
||||
[node name="RechargeStation" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -17)
|
||||
scale = Vector2(0.3, 0.3)
|
||||
texture = ExtResource("2_58ax0")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(1, -1)
|
||||
rotation = -1.5708
|
||||
shape = SubResource("CapsuleShape2D_bjhct")
|
||||
|
||||
[node name="RechargeStation" type="Sprite2D" parent="."]
|
||||
self_modulate = Color(0.729412, 0.588235, 0.105882, 1)
|
||||
position = Vector2(0, -17)
|
||||
scale = Vector2(0.3, 0.3)
|
||||
texture = ExtResource("2_58ax0")
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -40)
|
||||
scale = Vector2(0.375, 0.375)
|
||||
texture = ExtResource("3_3xua0")
|
||||
|
||||
Reference in New Issue
Block a user