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")
|
||||
|
||||
BIN
entities/objectives/assets/sprites/arbre_mort.png
Normal file
BIN
entities/objectives/assets/sprites/arbre_mort.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 127 KiB |
34
entities/objectives/assets/sprites/arbre_mort.png.import
Normal file
34
entities/objectives/assets/sprites/arbre_mort.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dbednu7eygtrf"
|
||||
path="res://.godot/imported/arbre_mort.png-eea217ee3fbf6520e6fbde71f18bbeef.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/objectives/assets/sprites/arbre_mort.png"
|
||||
dest_files=["res://.godot/imported/arbre_mort.png-eea217ee3fbf6520e6fbde71f18bbeef.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
|
||||
BIN
entities/objectives/assets/sprites/little_plant.png
Normal file
BIN
entities/objectives/assets/sprites/little_plant.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
34
entities/objectives/assets/sprites/little_plant.png.import
Normal file
34
entities/objectives/assets/sprites/little_plant.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c4pv2o7crchc0"
|
||||
path="res://.godot/imported/little_plant.png-e9ed84e9420c629c3911ff755b194643.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/objectives/assets/sprites/little_plant.png"
|
||||
dest_files=["res://.godot/imported/little_plant.png-e9ed84e9420c629c3911ff755b194643.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
|
||||
281
entities/objectives/objective.tscn
Normal file
281
entities/objectives/objective.tscn
Normal file
@@ -0,0 +1,281 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://djl2le58ckgdx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://j8fpi8rd8eyy" path="res://entities/objectives/scripts/objective.gd" id="1_3hqw5"]
|
||||
[ext_resource type="Texture2D" uid="uid://dbednu7eygtrf" path="res://entities/objectives/assets/sprites/arbre_mort.png" id="2_3hqw5"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4pv2o7crchc0" path="res://entities/objectives/assets/sprites/little_plant.png" id="3_dulsb"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="4_6uhem"]
|
||||
[ext_resource type="Texture2D" uid="uid://bo3o2qf3i20ke" path="res://common/icons/scuba-diving-tank.svg" id="5_6uhem"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_v08i5"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ArbreMort:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0.443137, 0.443137, 0.443137, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("LittlePlant:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("LittlePlant:scale")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("LittlePlant2:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("LittlePlant2:scale")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("LittlePlant3:visible")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/path = NodePath("LittlePlant3:scale")
|
||||
tracks/6/interp = 1
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("ArbreMort:scale")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.162791, 0.162791)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_6uhem"]
|
||||
resource_name = "activate"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ArbreMort:modulate")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0.443137, 0.443137, 0.443137, 1), Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("LittlePlant:visible")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.0333333),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("LittlePlant:scale")
|
||||
tracks/2/interp = 2
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.433333, 0.6),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("LittlePlant2:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0.0333333),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("LittlePlant2:scale")
|
||||
tracks/4/interp = 2
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0.6, 0.8),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("LittlePlant3:visible")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0.0333333),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/path = NodePath("LittlePlant3:scale")
|
||||
tracks/6/interp = 2
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
"times": PackedFloat32Array(0.4, 0.533333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0.094358, 0.094358)]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("ArbreMort:scale")
|
||||
tracks/7/interp = 2
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.266667, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.162791, 0.162791), Vector2(0.183, 0.093), Vector2(0.123, 0.178), Vector2(0.162791, 0.162791)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_047qm"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_v08i5"),
|
||||
&"activate": SubResource("Animation_6uhem")
|
||||
}
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bvagy"]
|
||||
radius = 24.0
|
||||
height = 160.0
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_v08i5"]
|
||||
font = ExtResource("4_6uhem")
|
||||
font_size = 18
|
||||
|
||||
[node name="Objective" type="Area2D"]
|
||||
script = ExtResource("1_3hqw5")
|
||||
metadata/_custom_type_script = "uid://d3bk52402ylvl"
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_047qm")
|
||||
}
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -20)
|
||||
rotation = 1.5708
|
||||
shape = SubResource("CapsuleShape2D_bvagy")
|
||||
|
||||
[node name="ArbreMort" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.443137, 0.443137, 0.443137, 1)
|
||||
position = Vector2(5, 4)
|
||||
scale = Vector2(0.162791, 0.162791)
|
||||
texture = ExtResource("2_3hqw5")
|
||||
centered = false
|
||||
offset = Vector2(-627.055, -607.11)
|
||||
|
||||
[node name="LittlePlant" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(-22, -46)
|
||||
scale = Vector2(0.094358, 0.094358)
|
||||
texture = ExtResource("3_dulsb")
|
||||
|
||||
[node name="LittlePlant2" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(39, -25)
|
||||
scale = Vector2(0.094358, 0.094358)
|
||||
texture = ExtResource("3_dulsb")
|
||||
|
||||
[node name="LittlePlant3" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(-49, -14)
|
||||
scale = Vector2(0.094358, 0.094358)
|
||||
texture = ExtResource("3_dulsb")
|
||||
|
||||
[node name="RewardInfo" type="HBoxContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
offset_left = -67.0
|
||||
offset_top = -34.0
|
||||
offset_right = 51.0
|
||||
offset_bottom = -15.0
|
||||
theme_override_constants/separation = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="RewardText" type="Label" parent="RewardInfo"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "bla"
|
||||
label_settings = SubResource("LabelSettings_v08i5")
|
||||
|
||||
[node name="RewardIcon" type="TextureRect" parent="RewardInfo"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("5_6uhem")
|
||||
expand_mode = 2
|
||||
@@ -0,0 +1,8 @@
|
||||
[gd_resource type="Resource" script_class="IncreaseDayLimitReward" load_steps=2 format=3 uid="uid://b11qyyi8k0mua"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://df6i1hivw4ymn" path="res://entities/objectives/scripts/rewards/increase_day_limit_reward.gd" id="1_gt31s"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_gt31s")
|
||||
day_limit_increase = 5
|
||||
metadata/_custom_type_script = "uid://df6i1hivw4ymn"
|
||||
@@ -0,0 +1,8 @@
|
||||
[gd_resource type="Resource" script_class="LootRandomSeedsReward" load_steps=2 format=3 uid="uid://ca62vcsijbxgc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bcdilfb4j7f6d" path="res://entities/objectives/scripts/rewards/loot_random_seeds_reward.gd" id="1_yjhoy"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_yjhoy")
|
||||
seeds_number = 5
|
||||
metadata/_custom_type_script = "uid://bcdilfb4j7f6d"
|
||||
21
entities/objectives/resources/loot_compost_reward.tres
Normal file
21
entities/objectives/resources/loot_compost_reward.tres
Normal file
@@ -0,0 +1,21 @@
|
||||
[gd_resource type="Resource" script_class="LootItemReward" load_steps=6 format=3 uid="uid://clmsn7r2shw6j"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dva05p817w00f" path="res://entities/objectives/scripts/rewards/loot_item_reward.gd" id="1_dyn78"]
|
||||
[ext_resource type="Texture2D" uid="uid://0xg54agef5gh" path="res://common/icons/package.svg" id="1_gvg4i"]
|
||||
[ext_resource type="PackedScene" uid="uid://bkwh1ntvgkkrt" path="res://entities/interactables/machines/compost/compost.tscn" id="2_22dgr"]
|
||||
[ext_resource type="Script" uid="uid://b6kubqgq0k7vj" path="res://common/inventory/scripts/items/package.gd" id="3_0bwtl"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_00nan"]
|
||||
script = ExtResource("3_0bwtl")
|
||||
scene = ExtResource("2_22dgr")
|
||||
name = "Compost"
|
||||
description = "The compost allow you to upgrade your max energy when putting in it a certain amount of seeds."
|
||||
icon = ExtResource("1_gvg4i")
|
||||
use_zone_radius = 5
|
||||
use_energy = 1
|
||||
metadata/_custom_type_script = "uid://b6kubqgq0k7vj"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_dyn78")
|
||||
item = SubResource("Resource_00nan")
|
||||
metadata/_custom_type_script = "uid://dva05p817w00f"
|
||||
37
entities/objectives/scripts/objective.gd
Normal file
37
entities/objectives/scripts/objective.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
extends InspectableEntity
|
||||
class_name Objective
|
||||
|
||||
const RANDOM_MAX_OBJECTIVE_INTERVAL = 1.
|
||||
|
||||
var completed : bool = false
|
||||
var planet : Planet
|
||||
@export var reward : ObjectiveReward = null :
|
||||
set(r):
|
||||
reward = r
|
||||
update_reward_info(r)
|
||||
|
||||
func _ready():
|
||||
update_reward_info(reward)
|
||||
|
||||
func pointer_text():
|
||||
return "Contamination Objective"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
"If the zone around is decontaminated, give the following reward.\n\n" + reward.get_description(),
|
||||
)
|
||||
|
||||
func _end_pass_day():
|
||||
if planet and not completed:
|
||||
if not planet.is_there_contamination(global_position):
|
||||
reward.reward(self)
|
||||
%AnimationPlayer.play("activate")
|
||||
%RewardInfo.visible = false
|
||||
completed = true
|
||||
|
||||
func update_reward_info(r : ObjectiveReward):
|
||||
if r:
|
||||
%RewardText.text = r.get_text()
|
||||
%RewardIcon.texture = r.get_icon()
|
||||
%RewardInfo.visible = r != null
|
||||
1
entities/objectives/scripts/objective.gd.uid
Normal file
1
entities/objectives/scripts/objective.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://j8fpi8rd8eyy
|
||||
14
entities/objectives/scripts/objective_reward.gd
Normal file
14
entities/objectives/scripts/objective_reward.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends Resource
|
||||
class_name ObjectiveReward
|
||||
|
||||
func reward(_objective : Objective):
|
||||
pass
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return null
|
||||
|
||||
func get_text() -> String:
|
||||
return ""
|
||||
|
||||
func get_description() -> String:
|
||||
return ""
|
||||
1
entities/objectives/scripts/objective_reward.gd.uid
Normal file
1
entities/objectives/scripts/objective_reward.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bsh4b8miag8w1
|
||||
@@ -0,0 +1,19 @@
|
||||
extends ObjectiveReward
|
||||
class_name IncreaseDayLimitReward
|
||||
|
||||
@export var day_limit_increase = 5
|
||||
|
||||
func _init(_day_limit_increase : int):
|
||||
day_limit_increase = _day_limit_increase
|
||||
|
||||
func reward(objective : Objective):
|
||||
objective.planet.day_limit += day_limit_increase
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/hourglass-empty.svg")
|
||||
|
||||
func get_text() -> String:
|
||||
return "+"+str(day_limit_increase)
|
||||
|
||||
func get_description() -> String:
|
||||
return "Increase the day limitation by " + str(day_limit_increase)
|
||||
@@ -0,0 +1 @@
|
||||
uid://df6i1hivw4ymn
|
||||
25
entities/objectives/scripts/rewards/loot_item_reward.gd
Normal file
25
entities/objectives/scripts/rewards/loot_item_reward.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends ObjectiveReward
|
||||
class_name LootItemReward
|
||||
|
||||
const REWARD_ITEM_RANDOM_DISPLACEMENT_FACTOR = 100
|
||||
|
||||
@export var item : Item
|
||||
|
||||
func _init(i : Item):
|
||||
item = i
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/package.svg")
|
||||
|
||||
func get_text() -> String:
|
||||
return ""
|
||||
|
||||
func get_description() -> String:
|
||||
return "Loot the following item: " + item.name + "."
|
||||
|
||||
func reward(objective : Objective):
|
||||
objective.planet.drop_item(
|
||||
item,
|
||||
objective.global_position,
|
||||
REWARD_ITEM_RANDOM_DISPLACEMENT_FACTOR
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
uid://dva05p817w00f
|
||||
@@ -0,0 +1 @@
|
||||
uid://dot5gfkbm7p6s
|
||||
@@ -0,0 +1,26 @@
|
||||
extends ObjectiveReward
|
||||
class_name LootRandomSeedsReward
|
||||
|
||||
const REWARD_SEED_RANDOM_DISPLACEMENT_FACTOR = 100
|
||||
|
||||
@export var seeds_number : int
|
||||
|
||||
func _init(number : int):
|
||||
seeds_number = number
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/seedling.svg")
|
||||
|
||||
func get_text() -> String:
|
||||
return str(seeds_number)
|
||||
|
||||
func get_description() -> String:
|
||||
return "Loot " + str(seeds_number) + " random seeds."
|
||||
|
||||
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()),
|
||||
objective.global_position,
|
||||
REWARD_SEED_RANDOM_DISPLACEMENT_FACTOR
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bcdilfb4j7f6d
|
||||
@@ -0,0 +1,19 @@
|
||||
extends ObjectiveReward
|
||||
class_name UpgradePlayerMaxEnergyReward
|
||||
|
||||
@export var upgrade_amount = 1
|
||||
|
||||
func _init(_upgrade_amount : int = 1):
|
||||
upgrade_amount = _upgrade_amount
|
||||
|
||||
func reward(objective : Objective):
|
||||
objective.planet.player.upgrade_max_energy(upgrade_amount)
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/bolt.svg")
|
||||
|
||||
func get_text() -> String:
|
||||
return "+"+str(upgrade_amount)+" max"
|
||||
|
||||
func get_description() -> String:
|
||||
return "Increase player max energy by " + str(upgrade_amount)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cflvw3bfcocnn
|
||||
@@ -2,7 +2,7 @@ extends InspectableEntity
|
||||
class_name Plant
|
||||
|
||||
const PLANT_AREA_WIDTH = 20
|
||||
const HARVESTED_SEED_POSITION_RANGE = 100
|
||||
const HARVESTED_SEED_DISPLACEMENT_FACTOR = 100
|
||||
|
||||
const RANDOM_MAX_GROW_INTERVAL = Planet.PASS_DAY_ANIMATION_TIME/2. - 0.1
|
||||
|
||||
@@ -88,24 +88,12 @@ func harvest():
|
||||
var seed_plant_type : PlantType = plant_type
|
||||
if len(plant_type.harvest_types_path):
|
||||
seed_plant_type = load(plant_type.harvest_types_path.pick_random())
|
||||
loot_seed(seed_plant_type)
|
||||
planet.drop_item(
|
||||
Seed.new(seed_plant_type),
|
||||
global_position,
|
||||
HARVESTED_SEED_DISPLACEMENT_FACTOR,
|
||||
)
|
||||
|
||||
plant_sprite.start_harvest_animation()
|
||||
await plant_sprite.harvest_animation_finished
|
||||
queue_free()
|
||||
|
||||
func loot_seed(type : PlantType):
|
||||
var item_object = planet.drop_item(
|
||||
Seed.new(type),
|
||||
global_position
|
||||
)
|
||||
var tween : Tween = get_tree().create_tween()
|
||||
tween.tween_property(
|
||||
item_object,
|
||||
"position",
|
||||
Vector2(
|
||||
item_object.position.x + randi()%HARVESTED_SEED_POSITION_RANGE,
|
||||
item_object.position.y + randi()%HARVESTED_SEED_POSITION_RANGE
|
||||
),
|
||||
0.2
|
||||
)
|
||||
|
||||
@@ -5,7 +5,11 @@ class_name ProduceSeedsEffect
|
||||
@export var produce_number : Array[int] = [1]
|
||||
|
||||
func effect(plant):
|
||||
for _i in range(produce_number.pick_random()):
|
||||
if len(produce_types_path):
|
||||
var seed_plant_type = load(produce_types_path.pick_random())
|
||||
plant.loot_seed(seed_plant_type)
|
||||
for _i in range(produce_number.pick_random()):
|
||||
if len(produce_types_path):
|
||||
var seed_plant_type = load(produce_types_path.pick_random())
|
||||
plant.planet.drop_item(
|
||||
Seed.new(seed_plant_type),
|
||||
plant.global_position,
|
||||
plant.HARVESTED_SEED_DISPLACEMENT_FACTOR,
|
||||
)
|
||||
|
||||
@@ -14,4 +14,4 @@ class_name PlantType
|
||||
@export var cyclic_effect : PlantEffect
|
||||
|
||||
@export_file var harvest_types_path : Array[String] = []
|
||||
@export var harvest_number : Array[int] = [1,2]
|
||||
@export var harvest_number : Array[int] = [1,2]
|
||||
@@ -3,7 +3,7 @@
|
||||
[ext_resource type="Script" uid="uid://das7twcy5153p" path="res://entities/player/scripts/player.gd" id="1_abrql"]
|
||||
[ext_resource type="Texture2D" uid="uid://c7ff87jniga5m" path="res://entities/player/assets/sprites/robot.png" id="1_symyc"]
|
||||
[ext_resource type="AudioStream" uid="uid://dfrp66a4isnt6" path="res://entities/player/sounds/dig/dig_1.wav" id="3_gx6sm"]
|
||||
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/inventory/assets/icons/shovel.svg" id="3_yqrof"]
|
||||
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/icons/shovel.svg" id="3_yqrof"]
|
||||
[ext_resource type="AudioStream" uid="uid://bdxkvaciw4mb3" path="res://entities/player/sounds/dig/dig_2.wav" id="4_yqrof"]
|
||||
[ext_resource type="AudioStream" uid="uid://llxrlwfccywb" path="res://entities/player/sounds/dig/dig_3.wav" id="5_3wlsy"]
|
||||
[ext_resource type="AudioStream" uid="uid://8nmr5vifkt1f" path="res://entities/player/sounds/harvest/harvest_1.wav" id="6_b2kln"]
|
||||
|
||||
@@ -41,7 +41,7 @@ func _start_pass_day():
|
||||
|
||||
# Méthode déclenchée par la classe planet
|
||||
func _pass_day():
|
||||
recharge()
|
||||
full_recharge()
|
||||
|
||||
# Méthode déclenchée par la classe planet
|
||||
func _end_pass_day():
|
||||
@@ -149,15 +149,19 @@ func use_item(item : Item):
|
||||
if item.is_one_time_use():
|
||||
delete_item(item)
|
||||
|
||||
func upgrade():
|
||||
max_energy += 1
|
||||
energy += 1
|
||||
func upgrade_max_energy(amount = 1):
|
||||
max_energy += amount
|
||||
upgraded.emit()
|
||||
player_updated.emit(self)
|
||||
|
||||
func recharge(amount : int = max_energy):
|
||||
energy = min(energy + amount, max_energy)
|
||||
energy = energy + amount
|
||||
upgraded.emit()
|
||||
|
||||
func generate_action_area(radius : int = 0) -> Area2D:
|
||||
func full_recharge():
|
||||
energy = max(energy, max_energy)
|
||||
|
||||
func generate_action_zone(radius : int = 0) -> Area2D:
|
||||
var area2D = Area2D.new()
|
||||
var collision_shape = CollisionShape2D.new()
|
||||
var circle_shape = CircleShape2D.new()
|
||||
@@ -173,13 +177,13 @@ func generate_action_area(radius : int = 0) -> Area2D:
|
||||
func setup_preview_zone(zone_radius : int) -> Area2D:
|
||||
if preview_zone:
|
||||
preview_zone.queue_free()
|
||||
preview_zone = generate_action_area(zone_radius)
|
||||
preview_zone = generate_action_zone(zone_radius)
|
||||
return preview_zone
|
||||
|
||||
func setup_action_zone(zone_position : Vector2, zone_radius : int) -> Area2D:
|
||||
if action_zone:
|
||||
action_zone.queue_free()
|
||||
action_zone = generate_action_area(zone_radius)
|
||||
action_zone = generate_action_zone(zone_radius)
|
||||
action_zone.global_position = zone_position
|
||||
return action_zone
|
||||
|
||||
|
||||
Reference in New Issue
Block a user