divers changements pour la sortie du second proto
* ajout du panneau solaire #54 * ajout d'un tutoriel #53 * equilibrage du jeu #73 * ajout d'un son pour l'annonce
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://cv2tf0tydqj5v"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bkwh1ntvgkkrt" path="res://entities/interactables/machines/compost/compost.tscn" id="1_8ajib"]
|
||||
[ext_resource type="Script" path="res://entities/interactables/machines/scripts/machine_info.gd" id="1_vktn1"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_vktn1")
|
||||
name = "Compost"
|
||||
scene = ExtResource("1_8ajib")
|
||||
description = "Can generate temporary energy in exchange of seeds."
|
||||
@@ -0,0 +1,10 @@
|
||||
[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://cv2tf0tydqj5v"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bkwh1ntvgkkrt" path="res://entities/interactables/machines/compost/compost_types/energy_compost.tscn" id="1_sy5wj"]
|
||||
[ext_resource type="Script" uid="uid://bhncww816fjsb" path="res://entities/interactables/machines/scripts/machine_info.gd" id="2_m8wft"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_m8wft")
|
||||
name = "Energy Compost"
|
||||
scene = ExtResource("1_sy5wj")
|
||||
description = "Can generate temporary energy in exchange of seeds."
|
||||
@@ -1,8 +1,8 @@
|
||||
[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"]
|
||||
[ext_resource type="Script" uid="uid://bw2ckthka71y8" path="res://entities/interactables/machines/compost/scripts/energy_compost.gd" id="1_2s0lp"]
|
||||
[ext_resource type="Texture2D" uid="uid://f2rte5jc0psp" path="res://entities/interactables/machines/compost/assets/sprites/compost.svg" id="2_pi0jt"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_85qj7"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_akkx7"]
|
||||
size = Vector2(66, 84)
|
||||
@@ -26,7 +26,7 @@ length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Compost:scale")
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
@@ -38,7 +38,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Compost:position")
|
||||
tracks/1/path = NodePath("Sprite:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@@ -54,7 +54,7 @@ length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Compost:position")
|
||||
tracks/0/path = NodePath("Sprite:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
@@ -66,7 +66,7 @@ tracks/0/keys = {
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Compost:scale")
|
||||
tracks/1/path = NodePath("Sprite:scale")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
@@ -82,7 +82,7 @@ length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Compost:scale")
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
@@ -99,18 +99,19 @@ _data = {
|
||||
&"fill": SubResource("Animation_etofw")
|
||||
}
|
||||
|
||||
[node name="Compost" type="Area2D"]
|
||||
script = ExtResource("1_c0pig")
|
||||
[node name="EnergyCompost" type="Area2D"]
|
||||
script = ExtResource("1_2s0lp")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_akkx7")
|
||||
|
||||
[node name="Compost" type="Sprite2D" parent="."]
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
self_modulate = Color(0.729698, 0.588265, 0.105405, 1)
|
||||
scale = Vector2(0.291262, 0.291262)
|
||||
texture = ExtResource("2_r6435")
|
||||
texture = ExtResource("2_pi0jt")
|
||||
|
||||
[node name="ProgressBar" type="ProgressBar" parent="Compost"]
|
||||
[node name="ProgressBar" type="ProgressBar" parent="Sprite"]
|
||||
unique_name_in_owner = true
|
||||
offset_left = -62.0
|
||||
offset_top = -7.0
|
||||
@@ -121,11 +122,11 @@ theme_override_styles/fill = SubResource("StyleBoxFlat_3ao1n")
|
||||
fill_mode = 3
|
||||
show_percentage = false
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="Compost"]
|
||||
[node name="Bolt" type="Sprite2D" parent="Sprite"]
|
||||
z_index = 1
|
||||
position = Vector2(0, 54.9334)
|
||||
scale = Vector2(2.00278, 2.00278)
|
||||
texture = ExtResource("3_akkx7")
|
||||
texture = ExtResource("3_85qj7")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
@@ -0,0 +1,11 @@
|
||||
[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://bbaiexmnroxos"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://b13debm055r3t" path="res://entities/interactables/machines/compost/compost_types/seed_compost.tscn" id="1_vpkcm"]
|
||||
[ext_resource type="Script" uid="uid://bhncww816fjsb" path="res://entities/interactables/machines/scripts/machine_info.gd" id="2_tfoq0"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_tfoq0")
|
||||
name = "Seed Compost"
|
||||
scene = ExtResource("1_vpkcm")
|
||||
description = "Give random seed if is filled with seeds."
|
||||
metadata/_custom_type_script = "uid://bhncww816fjsb"
|
||||
@@ -0,0 +1,134 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://b13debm055r3t"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d0yt8pd41j2os" path="res://entities/interactables/machines/compost/scripts/seed_compost.gd" id="1_b8mmk"]
|
||||
[ext_resource type="Texture2D" uid="uid://f2rte5jc0psp" path="res://entities/interactables/machines/compost/assets/sprites/compost.svg" id="2_s8eov"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0wy3dbpxbnt7" path="res://common/icons/seedling.svg" id="3_s8eov"]
|
||||
|
||||
[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)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3ao1n"]
|
||||
bg_color = Color(0.270222, 0.270222, 0.270222, 1)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r6435"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_1758a"]
|
||||
resource_name = "empty"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0, 12.605), Vector2(0, -24.56), Vector2(0, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:scale")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262), Vector2(0.291, 0.191), Vector2(0.291, 0.366), Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_etofw"]
|
||||
resource_name = "fill"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262), Vector2(0.291, 0.231), Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_etofw"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_r6435"),
|
||||
&"empty": SubResource("Animation_1758a"),
|
||||
&"fill": SubResource("Animation_etofw")
|
||||
}
|
||||
|
||||
[node name="Compost" type="Area2D"]
|
||||
script = ExtResource("1_b8mmk")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_akkx7")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
self_modulate = Color(0.90820795, 0.68268144, 0.2216644, 1)
|
||||
scale = Vector2(0.291262, 0.291262)
|
||||
texture = ExtResource("2_s8eov")
|
||||
|
||||
[node name="ProgressBar" type="ProgressBar" parent="Sprite"]
|
||||
unique_name_in_owner = true
|
||||
offset_left = -62.0
|
||||
offset_top = -7.0
|
||||
offset_right = 62.0
|
||||
offset_bottom = 120.0
|
||||
theme_override_styles/background = SubResource("StyleBoxFlat_etofw")
|
||||
theme_override_styles/fill = SubResource("StyleBoxFlat_3ao1n")
|
||||
fill_mode = 3
|
||||
show_percentage = false
|
||||
|
||||
[node name="Bolt" type="Sprite2D" parent="Sprite"]
|
||||
z_index = 1
|
||||
position = Vector2(0, 54.9334)
|
||||
scale = Vector2(2.00278, 2.00278)
|
||||
texture = ExtResource("3_s8eov")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_etofw")
|
||||
}
|
||||
@@ -5,17 +5,14 @@ var containing_seed : int = 0
|
||||
|
||||
func get_seed_needed(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 3
|
||||
2: return 2
|
||||
3: return 2
|
||||
_: return 1
|
||||
|
||||
func get_energy_production(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 1
|
||||
2: return 1
|
||||
1: return 5
|
||||
2: return 4
|
||||
3: return 3
|
||||
_: return 2
|
||||
|
||||
func setup_machine_sprite():
|
||||
%Sprite.self_modulate = Machine.get_level_color(level)
|
||||
|
||||
func _process(_delta):
|
||||
%ProgressBar.value = lerp(%ProgressBar.value, float(containing_seed) / float(get_seed_needed()) * 100, 0.5)
|
||||
|
||||
@@ -35,7 +32,10 @@ func interact(p : Player) -> bool:
|
||||
if containing_seed >= get_seed_needed():
|
||||
$AnimationPlayer.play("empty")
|
||||
containing_seed = 0
|
||||
p.recharge(get_energy_production())
|
||||
product(p)
|
||||
else:
|
||||
$AnimationPlayer.play("fill")
|
||||
return true
|
||||
|
||||
func product(player : Player):
|
||||
pass
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
extends Compost
|
||||
class_name EnergyCompost
|
||||
|
||||
func get_energy_production(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 1
|
||||
2: return 1
|
||||
3: return 1
|
||||
_: return 1
|
||||
|
||||
func product(player : Player):
|
||||
player.recharge(get_energy_production())
|
||||
@@ -0,0 +1 @@
|
||||
uid://bw2ckthka71y8
|
||||
@@ -0,0 +1,17 @@
|
||||
extends Compost
|
||||
class_name SeedCompost
|
||||
|
||||
func get_seeds_production(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 2
|
||||
2: return 2
|
||||
3: return 2
|
||||
_: return 1
|
||||
|
||||
func product(player : Player):
|
||||
for i in range(get_seeds_production()):
|
||||
player.planet.drop_item(
|
||||
Seed.new(GameInfo.game_data.unlocked_plant_types.pick_random()),
|
||||
global_position,
|
||||
100
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
uid://d0yt8pd41j2os
|
||||
@@ -1,7 +1,7 @@
|
||||
extends Interactable
|
||||
class_name Machine
|
||||
|
||||
const MAX_MACHINE_LEVEL = 5
|
||||
const MAX_MACHINE_LEVEL = 3
|
||||
|
||||
var level : int = 1
|
||||
var machine_name : String = ""
|
||||
@@ -11,6 +11,10 @@ func setup_machine_info(machine_type : MachineType, _level : int = 1):
|
||||
level = _level
|
||||
machine_name = machine_type.name
|
||||
machine_desc = machine_type.description
|
||||
setup_machine_sprite()
|
||||
|
||||
func setup_machine_sprite():
|
||||
pass
|
||||
|
||||
func pointer_text():
|
||||
return machine_name
|
||||
@@ -20,3 +24,10 @@ func inspector_info() -> Inspector.Info:
|
||||
pointer_text() + " level " + str(level),
|
||||
machine_desc
|
||||
)
|
||||
|
||||
static func get_level_color(l : int) -> Color:
|
||||
match l:
|
||||
1: return Color("4ed38a")
|
||||
2: return Color("4ec6ee")
|
||||
3: return Color("bd70e2")
|
||||
_: return Color("bd70e2")
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 283 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cqqlkm14lawpa"
|
||||
path="res://.godot/imported/panneau_solaire_1.png-b9a4049f295152380ed394a82c03b8e2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png"
|
||||
dest_files=["res://.godot/imported/panneau_solaire_1.png-b9a4049f295152380ed394a82c03b8e2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 657 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b1n8nad43usw4"
|
||||
path="res://.godot/imported/panneau_solaire_2.png-479b68803815c59c599ff8c3a78ca895.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png"
|
||||
dest_files=["res://.godot/imported/panneau_solaire_2.png-479b68803815c59c599ff8c3a78ca895.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 369 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c22re5wfsm1ax"
|
||||
path="res://.godot/imported/panneau_solaire_3.png-022ae039aa352e1519471d4f9c114a8b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png"
|
||||
dest_files=["res://.godot/imported/panneau_solaire_3.png-022ae039aa352e1519471d4f9c114a8b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
@@ -0,0 +1,49 @@
|
||||
extends Machine
|
||||
class_name SolarPanel
|
||||
|
||||
var charged : bool = false : set = set_charged
|
||||
var recharge_days : int = 0
|
||||
|
||||
func get_days_to_recharge(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 2
|
||||
2: return 2
|
||||
3: return 2
|
||||
_: return 1
|
||||
|
||||
func get_energy_production(l : int = level) -> int:
|
||||
match l:
|
||||
1: return 1
|
||||
2: return 2
|
||||
3: return 3
|
||||
_: return 1
|
||||
|
||||
# Méthode déclenchée par la classe planet
|
||||
func _pass_day():
|
||||
if not charged:
|
||||
recharge_days += 1
|
||||
print(get_days_to_recharge())
|
||||
if recharge_days >= get_days_to_recharge():
|
||||
set_charged(true)
|
||||
|
||||
func set_charged(_charged = true):
|
||||
charged = _charged
|
||||
recharge_days = 0
|
||||
if charged:
|
||||
%AnimationPlayer.play("charged")
|
||||
else :
|
||||
%AnimationPlayer.play_backwards("charged")
|
||||
|
||||
func setup_machine_sprite():
|
||||
%Base.self_modulate = Machine.get_level_color(level)
|
||||
|
||||
func interact_text():
|
||||
return "Recharge " + str(get_energy_production()) + " energy"
|
||||
|
||||
func can_interact(_p : Player) -> bool:
|
||||
return charged
|
||||
|
||||
func interact(p : Player) -> bool:
|
||||
p.recharge(get_energy_production())
|
||||
set_charged(false)
|
||||
return true
|
||||
@@ -0,0 +1 @@
|
||||
uid://bjy8gc0eyl2ss
|
||||
@@ -0,0 +1,11 @@
|
||||
[gd_resource type="Resource" script_class="MachineType" load_steps=3 format=3 uid="uid://dew3p4fffjryo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bhncww816fjsb" path="res://entities/interactables/machines/scripts/machine_info.gd" id="1_ctita"]
|
||||
[ext_resource type="PackedScene" uid="uid://gwq2oos6ljyp" path="res://entities/interactables/machines/solar_pannel/solar_pannel.tscn" id="1_naexs"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ctita")
|
||||
name = "Solar Pannel"
|
||||
scene = ExtResource("1_naexs")
|
||||
description = "Produce energy evry 2 days. When charged, can be used to recharge energy."
|
||||
metadata/_custom_type_script = "uid://bhncww816fjsb"
|
||||
@@ -0,0 +1,99 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://gwq2oos6ljyp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bjy8gc0eyl2ss" path="res://entities/interactables/machines/solar_pannel/scripts/solar_pannel.gd" id="1_t4vnu"]
|
||||
[ext_resource type="Texture2D" uid="uid://b1n8nad43usw4" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_2.png" id="2_ny3sb"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqqlkm14lawpa" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_1.png" id="3_bml32"]
|
||||
[ext_resource type="Texture2D" uid="uid://c22re5wfsm1ax" path="res://entities/interactables/machines/solar_pannel/assets/sprites/panneau_solaire_3.png" id="4_ob8kj"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6utw7"]
|
||||
radius = 48.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gal8b"]
|
||||
resource_name = "charged"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprites/Pannels:modulate")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.033333335, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0.42365062, 0.42365065, 0.42365062, 1), Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprites/Flair:modulate")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_77hon"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprites/Pannels:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0.42352942, 0.42352942, 0.42352942, 1)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprites/Flair:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5vw1f"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_77hon"),
|
||||
&"charged": SubResource("Animation_gal8b")
|
||||
}
|
||||
|
||||
[node name="SolarPannel" type="Area2D"]
|
||||
script = ExtResource("1_t4vnu")
|
||||
metadata/_custom_type_script = "uid://du7qppxobx5nd"
|
||||
|
||||
[node name="Sprites" type="Node2D" parent="."]
|
||||
position = Vector2(15.999999, -16.999998)
|
||||
scale = Vector2(0.09, 0.09)
|
||||
|
||||
[node name="Pannels" type="Sprite2D" parent="Sprites"]
|
||||
modulate = Color(0.42352942, 0.42352942, 0.42352942, 1)
|
||||
texture = ExtResource("2_ny3sb")
|
||||
|
||||
[node name="Base" type="Sprite2D" parent="Sprites"]
|
||||
unique_name_in_owner = true
|
||||
texture = ExtResource("3_bml32")
|
||||
|
||||
[node name="Flair" type="Sprite2D" parent="Sprites"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
texture = ExtResource("4_ob8kj")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(6, -23)
|
||||
shape = SubResource("CircleShape2D_6utw7")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_5vw1f")
|
||||
}
|
||||
Reference in New Issue
Block a user