ajout d'effet de post processing et réparation des graines

This commit is contained in:
2026-02-27 00:51:06 +01:00
parent a4662f2797
commit 8b3d5a98e1
19 changed files with 268 additions and 64 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://do3wxh7k38m7u"
path="res://.godot/imported/seed_buried_texture.png-1822d7240070f3b15514c261d06c7402.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/plants/assets/sprites/seed_buried_texture.png"
dest_files=["res://.godot/imported/seed_buried_texture.png-1822d7240070f3b15514c261d06c7402.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

View File

@@ -2,6 +2,7 @@
[ext_resource type="Script" uid="uid://bmjjpk4lvijws" path="res://entities/plants/scripts/plant_sprite.gd" id="1_pq8o7"]
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="3_j6jm5"]
[ext_resource type="Texture2D" uid="uid://do3wxh7k38m7u" path="res://entities/plants/assets/sprites/seed_buried_texture.png" id="3_rbgiq"]
[sub_resource type="AtlasTexture" id="AtlasTexture_wyuub"]
atlas = ExtResource("3_j6jm5")
@@ -107,11 +108,17 @@ scale = Vector2(0.15, 0.15)
[node name="PlantedSeed" type="Sprite2D" parent="Sprite" unique_id=1134686525]
unique_name_in_owner = true
position = Vector2(0, 653.33325)
scale = Vector2(1.5, 1.5)
texture = SubResource("AtlasTexture_wyuub")
region_rect = Rect2(0, -50, 124, 135)
region_filter_clip_enabled = true
[node name="SeedBuriedTexture" type="Sprite2D" parent="Sprite/PlantedSeed" unique_id=2046939355]
position = Vector2(4.444448, 31.11118)
scale = Vector2(3.1777775, 3.1777775)
texture = ExtResource("3_rbgiq")
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=1793068152]
unique_name_in_owner = true
libraries/ = SubResource("AnimationLibrary_8eofq")

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
@tool
extends PlantTextureBuilderInstance
@export var hash : int = 0 :
set(v):
hash = v
update_seed_sprite()
func _ready():
update_seed_sprite()
func update_seed_sprite():
if is_node_ready():
%Sprite2D.texture = build_seed_texture(hash)

View File

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

View File

@@ -1,4 +1,5 @@
extends Node
class_name PlantTextureBuilderInstance
const IMAGE_WIDTH := 2048
const IMAGE_HEIGHT := 2048
@@ -75,23 +76,29 @@ func shuffle_weighted(array: Array, weights: Array[int]):
func build_seed_texture(random_seed: int) -> Texture:
rng.seed = random_seed
var texture_set: SeedTextureSet = pick_random(seed_texture_sets)
var seed_image := Image.create(SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE, false, Image.FORMAT_RGBA8)
for color_image in texture_set.color_images:
color_image.resize(SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE)
var texture_set : SeedTextureSet = pick_random(seed_texture_sets)
var seed_image := Image.create(SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE, false, Image.FORMAT_RGBA8)
for color_texture in texture_set.color_textures:
var color_image = color_texture.get_image().duplicate()
color_image.resize(SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE)
modulate_image(color_image, pick_random(COLOR_PALETTE))
seed_image.blend_rect(color_image, Rect2i(0, 0, SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE), Vector2i.ZERO)
if texture_set.outline_image:
var outline_image = texture_set.outline_image
outline_image.resize(SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE)
seed_image.blend_rect(outline_image, Rect2i(0, 0, SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE), Vector2i.ZERO)
seed_image.blend_rect(
color_image,
Rect2i(0,0,SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE),
Vector2i.ZERO
)
if texture_set.outline_texture:
var outline_image = texture_set.outline_texture.get_image().duplicate()
outline_image.resize(SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE)
seed_image.blend_rect(outline_image, Rect2i(0,0,SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE),Vector2i.ZERO)
if rng.randi() % 2 == 0:
if rng.randi()%2 == 0:
seed_image.flip_x()
return ImageTexture.create_from_image(image)
return ImageTexture.create_from_image(seed_image)
func build_plant_texture(plant_data: PlantData) -> Texture:
rng.seed = plant_data.random_seed

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://drgl0d51d4cf7"
path="res://.godot/imported/radial-gradient.png-f036338c44c4cdc3990cfae457a24205.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/player/assets/sprites/radial-gradient.png"
dest_files=["res://.godot/imported/radial-gradient.png-f036338c44c4cdc3990cfae457a24205.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

View File

@@ -59,6 +59,7 @@ func get_description() -> String:
return tr("PLANT_%s_MUST_BE_USED_IN_DECONTAMINATED_ZONE") % plant_name
func get_icon() -> Texture2D:
print("getting icon")
if stored_icon == null:
stored_icon = PlantTextureBuilder.build_seed_texture(plant_name.hash())
return stored_icon

View File

@@ -48,8 +48,9 @@ func use(player : Player, zone : Player.ActionZone) -> bool:
rock_layer.dig_rocks(zone.get_tiles())
var particles := (DIG_PARTICLES.instantiate() as Node2D)
var particles := (DIG_PARTICLES.instantiate() as DigParticleEmmitter)
player.region.add_child(particles)
particles.global_position = zone.get_global_position()
particles.emit()
return true

View File

@@ -20,6 +20,7 @@ unique_name_in_owner = true
amount = 10
lifetime = 1.0
speed_scale = 3.0
emission_sphere_radius = 60.0
spread = 50.0
gravity = Vector2(0, 400)
initial_velocity_min = 150.0

View File

@@ -1,6 +1,7 @@
extends Node2D
class_name DigParticleEmmitter
func _ready():
func emit():
%ExplosionParticles.emitting = true
%ExplosionParticles.finished.connect(
func (): queue_free()

View File

@@ -4,7 +4,8 @@
[ext_resource type="Texture2D" uid="uid://dompaj451gklw" path="res://entities/player/assets/sprites/movement_particles.png" id="2_bls4j"]
[ext_resource type="Texture2D" uid="uid://ys5fis3gsnoy" path="res://entities/player/assets/sprites/shadow.png" id="2_fkugw"]
[ext_resource type="Texture2D" uid="uid://c7ff87jniga5m" path="res://entities/player/assets/sprites/robot.png" id="4_bls4j"]
[ext_resource type="Script" path="res://entities/player/scripts/player_sprite.gd" id="5_fkugw"]
[ext_resource type="Texture2D" uid="uid://drgl0d51d4cf7" path="res://entities/player/assets/sprites/radial-gradient.png" id="5_8fjmc"]
[ext_resource type="Script" uid="uid://b1mmtgmi5oq86" path="res://entities/player/scripts/player_sprite.gd" id="5_fkugw"]
[sub_resource type="CircleShape2D" id="CircleShape2D_sglur"]
radius = 27.0
@@ -12,14 +13,6 @@ radius = 27.0
[sub_resource type="CircleShape2D" id="CircleShape2D_abrql"]
radius = 40.0
[sub_resource type="Curve" id="Curve_fkugw"]
_data = [Vector2(0, 0.14473677), 0.0, 0.0, 0, 0, Vector2(0.972549, 0.2654798), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Gradient" id="Gradient_bls4j"]
offsets = PackedFloat32Array(0, 0.77729255, 1)
colors = PackedColorArray(0.5803922, 0.7058824, 0.8862745, 1, 0.5785, 0.70829165, 0.89, 1, 0.5785, 0.70829165, 0.89, 0)
[sub_resource type="AtlasTexture" id="AtlasTexture_fkugw"]
atlas = ExtResource("4_bls4j")
region = Rect2(3048, 0, 762, 1080)
@@ -119,6 +112,14 @@ animations = [{
"speed": 5.0
}]
[sub_resource type="Curve" id="Curve_fkugw"]
_data = [Vector2(0, 0.14473677), 0.0, 0.0, 0, 0, Vector2(0.972549, 0.2654798), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Gradient" id="Gradient_bls4j"]
offsets = PackedFloat32Array(0, 0.77729255, 1)
colors = PackedColorArray(0.5803922, 0.7058824, 0.8862745, 1, 0.5785, 0.70829165, 0.89, 1, 0.5785, 0.70829165, 0.89, 0)
[sub_resource type="Animation" id="Animation_fkugw"]
length = 0.001
tracks/0/type = "value"
@@ -170,20 +171,11 @@ position = Vector2(0, -12)
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractArea2D" unique_id=1242017003]
shape = SubResource("CircleShape2D_abrql")
[node name="CPUParticles2D" type="CPUParticles2D" parent="InteractArea2D" unique_id=1489736082]
position = Vector2(-8.4703295e-22, 12)
scale = Vector2(0.22803418, 0.22803418)
amount = 3
texture = ExtResource("2_bls4j")
lifetime = 0.4
gravity = Vector2(0, 100)
scale_amount_curve = SubResource("Curve_fkugw")
color_ramp = SubResource("Gradient_bls4j")
[node name="Shadow" type="Sprite2D" parent="." unique_id=875064259]
modulate = Color(0, 0, 0, 0.41568628)
modulate = Color(0, 0, 0, 1)
z_index = -1
scale = Vector2(0.41025653, 0.41025642)
position = Vector2(-2.3841858e-07, -7.999996)
scale = Vector2(0.29154927, 0.29154924)
texture = ExtResource("2_fkugw")
[node name="PlayerSprite" type="AnimatedSprite2D" parent="." unique_id=638545037]
@@ -191,11 +183,29 @@ unique_name_in_owner = true
position = Vector2(0.99999994, -17)
scale = Vector2(0.0656168, 0.065616846)
sprite_frames = SubResource("SpriteFrames_a1qjk")
animation = &"right"
animation = &"front_left"
frame_progress = 0.15805355
offset = Vector2(0, -370)
script = ExtResource("5_fkugw")
wanted_orientation = 2
[node name="Light" type="Sprite2D" parent="PlayerSprite" unique_id=1768327734]
modulate = Color(0.70603025, 0.5959886, 0.33971557, 0.09019608)
z_index = -1
scale = Vector2(16.093441, 16.093441)
texture = ExtResource("5_8fjmc")
[node name="CPUParticles2D" type="CPUParticles2D" parent="PlayerSprite" unique_id=1489736082]
z_index = -1
position = Vector2(-15.239999, -60.95996)
scale = Vector2(3.4752407, 3.4752383)
amount = 3
texture = ExtResource("2_bls4j")
lifetime = 0.4
gravity = Vector2(0, 100)
scale_amount_curve = SubResource("Curve_fkugw")
color_ramp = SubResource("Gradient_bls4j")
[node name="FloatAnimationPlayer" type="AnimationPlayer" parent="." unique_id=793749564]
libraries/ = SubResource("AnimationLibrary_qiwj3")
autoplay = &"float"