#46 ajout d'une borne de recharge et changements mineurs du gameplay

This commit is contained in:
2025-08-22 12:22:24 +02:00
parent dbb6855585
commit 3d0104ed4a
30 changed files with 400 additions and 246 deletions

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="65.888519mm"
height="56.356422mm"
viewBox="0 0 65.888519 56.356422"
version="1.1"
id="svg1"
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
sodipodi:docname="recharge_station.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#ffffff"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#505050"
inkscape:document-units="mm"
inkscape:zoom="1.5821549"
inkscape:cx="45.82358"
inkscape:cy="147.89955"
inkscape:window-width="1920"
inkscape:window-height="1009"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1" />
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-72.05574,-18.228039)">
<rect
style="fill:#d1d1d1;fill-opacity:1;stroke-width:0.264583;stroke-linecap:square"
id="rect1"
width="16.054054"
height="35.392433"
x="96.972969"
y="18.228039"
rx="5"
ry="5" />
<ellipse
style="fill:#ffffff;stroke-width:0.264583;stroke-linecap:square"
id="path1"
cx="105"
cy="60.537163"
rx="32.94426"
ry="14.047297" />
<ellipse
style="fill:#d1d1d1;fill-opacity:1;stroke-width:0.264583;stroke-linecap:square"
id="ellipse1"
cx="105"
cy="60.537163"
rx="16.221287"
ry="6.9166899" />
<circle
style="fill:#ffffff;fill-opacity:1;stroke-width:0.264583;stroke-linecap:square"
id="path2"
cx="105"
cy="26.171452"
r="5.685811" />
<g
id="g3"
transform="translate(0.20904541)">
<circle
style="fill:#d1d1d1;fill-opacity:1;stroke-width:0.264583;stroke-linecap:square"
id="circle2"
cx="102.61697"
cy="26.171452"
r="1.5050678" />
<circle
style="fill:#d1d1d1;fill-opacity:1;stroke-width:0.264583;stroke-linecap:square"
id="circle3"
cx="106.96494"
cy="26.171452"
r="1.5050678" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c82ljr3in67am"
path="res://.godot/imported/recharge_station.svg-e388da7bbc5335a093731cd3d5c6eb67.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/recharge_station/assets/sprites/recharge_station.svg"
dest_files=["res://.godot/imported/recharge_station.svg-e388da7bbc5335a093731cd3d5c6eb67.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@@ -0,0 +1,23 @@
[gd_scene load_steps=4 format=3 uid="uid://d324mlmgls4fs"]
[ext_resource type="Script" uid="uid://bsrn3gd2a532q" path="res://entities/interactables/recharge_station/scripts/recharge_station.gd" id="1_2ffjo"]
[ext_resource type="Texture2D" uid="uid://c82ljr3in67am" path="res://entities/interactables/recharge_station/assets/sprites/recharge_station.svg" id="2_58ax0"]
[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")

View File

@@ -0,0 +1,13 @@
extends Interactable
class_name RechargeStation
var planet : Planet # mis à jour par la classe Planet
func interact(_p: Player) -> bool:
planet.pass_day()
return true
func interact_text():
return "Recharge"

View File

@@ -0,0 +1 @@
uid://bsrn3gd2a532q

View File

@@ -6,9 +6,6 @@ var available : bool = true
func can_interact(_p : Player) -> bool:
return true
func interact_requirement_text() -> String:
return ""
func interact(_p : Player) -> bool:
printerr("Interact function called on abstract Interactable class")
return false

View File

@@ -9,7 +9,7 @@
[sub_resource type="Resource" id="Resource_q68uy"]
script = ExtResource("2_cky1j")
impact_radius = 100
impact_radius = 150
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
[sub_resource type="AtlasTexture" id="AtlasTexture_qt76e"]
@@ -19,7 +19,7 @@ region = Rect2(1140, 345, 141, 128)
[resource]
script = ExtResource("1_moyj3")
name = "Chardi"
description = "This plant reduce contamination around when it becomes mature."
description = "This plant remove a lot of contamination around when it becomes mature."
growing_time = 1
seed_texture = SubResource("AtlasTexture_qt76e")
planted_texture = ExtResource("4_2s6re")

View File

@@ -1,11 +1,17 @@
[gd_resource type="Resource" script_class="PlantType" load_steps=7 format=3 uid="uid://dsctivn1vrem2"]
[gd_resource type="Resource" script_class="PlantType" load_steps=9 format=3 uid="uid://dsctivn1vrem2"]
[ext_resource type="Script" uid="uid://jnye5pe1bgqw" path="res://entities/plants/scripts/plant_type.gd" id="1_eqtut"]
[ext_resource type="Texture2D" uid="uid://dwr3c6r6piwaa" path="res://entities/plants/assets/sprites/maias/growing.png" id="1_vyplc"]
[ext_resource type="Script" path="res://entities/plants/scripts/plant_effects/decontaminate_terrain_effect.gd" id="2_vyplc"]
[ext_resource type="Texture2D" uid="uid://d3apfwbqsg5ha" path="res://entities/plants/assets/sprites/maias/mature.png" id="3_pi4ie"]
[ext_resource type="Texture2D" uid="uid://cpx7bkrvttasr" path="res://entities/plants/assets/sprites/maias/planted.png" id="4_iqcy2"]
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_mwrj8"]
[sub_resource type="Resource" id="Resource_q4pje"]
script = ExtResource("2_vyplc")
impact_radius = 20
metadata/_custom_type_script = "uid://cgscbuxe4dawb"
[sub_resource type="AtlasTexture" id="AtlasTexture_sri3b"]
atlas = ExtResource("6_mwrj8")
region = Rect2(1697, 331, 125, 158)
@@ -13,12 +19,13 @@ region = Rect2(1697, 331, 125, 158)
[resource]
script = ExtResource("1_eqtut")
name = "Maias"
description = "This gorgeous flower has no effect, but produce a lot of seeds."
description = "This gorgeous flower produce a lot of seeds."
growing_time = 1
seed_texture = SubResource("AtlasTexture_sri3b")
planted_texture = ExtResource("4_iqcy2")
growing_texture = ExtResource("1_vyplc")
mature_texture = ExtResource("3_pi4ie")
mature_effect = SubResource("Resource_q4pje")
harvest_types_path = Array[String](["uid://b04vho33bl52b", "uid://dsctivn1vrem2"])
harvest_number = Array[int]([3, 4])
metadata/_custom_type_script = "uid://jnye5pe1bgqw"

View File

@@ -4,7 +4,7 @@ class_name Plant
const PLANT_AREA_WIDTH = 20
const HARVESTED_SEED_POSITION_RANGE = 100
const RANDOM_MAX_GROW_INTERVAL = 0.4
const RANDOM_MAX_GROW_INTERVAL = Planet.PASS_DAY_ANIMATION_TIME/2. - 0.1
const SPRITE_SCENE : PackedScene = preload("res://entities/plants/plant_sprite.tscn")

View File

@@ -48,23 +48,22 @@ func _ready():
Pointer.player = self
# Méthode déclenchée par la classe planet
func _pass_day():
energy = max_energy
func _start_pass_day():
controlling_player = false
target_interactable = null
# Méthode déclenchée par la classe planet
func _pass_day():
recharge()
# Méthode déclenchée par la classe planet
func _end_pass_day():
controlling_player = true
func _process(_delta):
get_input()
move_and_slide()
func _on_root_gui_day_pass_pressed():
controlling_player = false
func _on_root_gui_day_pass_finished():
controlling_player = true
func _on_root_gui_game_click():
try_use_item()
func _on_inventory_updated(_inventory: Inventory):
emit_signal("player_updated", self)
@@ -162,6 +161,9 @@ func upgrade():
energy += 1
upgraded.emit()
func recharge(amount : int = max_energy):
energy = min(energy + amount, max_energy)
func play_sfx(sound : String):
match sound:
"dig":