grow sprouts !

This commit is contained in:
veclavtalica 2025-02-12 05:28:48 +03:00
parent f08f820948
commit ad773f68eb
9 changed files with 96 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

BIN
assets/sprout1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

View File

@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://d35y5ckne72qe"
path="res://.godot/imported/sprout.png-98a4ab515d3bfdbd6f6db7d14b52ead7.ctex"
path="res://.godot/imported/sprout1.png-dff2839b1c813110ff5aa31e8e7778fa.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/sprout.png"
dest_files=["res://.godot/imported/sprout.png-98a4ab515d3bfdbd6f6db7d14b52ead7.ctex"]
source_file="res://assets/sprout1.png"
dest_files=["res://.godot/imported/sprout1.png-dff2839b1c813110ff5aa31e8e7778fa.ctex"]
[params]

BIN
assets/sprout2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

34
assets/sprout2.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cry83nqqrybsl"
path="res://.godot/imported/sprout2.png-78a96837ad5731e502156d9c69e4b8bd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/sprout2.png"
dest_files=["res://.godot/imported/sprout2.png-78a96837ad5731e502156d9c69e4b8bd.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
assets/sprout3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

34
assets/sprout3.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://4kt11i2bobre"
path="res://.godot/imported/sprout3.png-0beb960d42dc411ef10af15a6f1954b4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/sprout3.png"
dest_files=["res://.godot/imported/sprout3.png-0beb960d42dc411ef10af15a6f1954b4.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

View File

@ -2,8 +2,11 @@ extends Node3D
@export var _need_water_drop: Sprite3D
@export var _production_timer: Timer
@export var _sprite: Sprite3D
var needs_water := true
var stage: int = 1
var final_stage: int = 3
func _ready() -> void:
@ -17,16 +20,26 @@ func _on_production_timer_timeout() -> void:
@rpc("authority", "call_local", "reliable")
func _reflect_combo() -> void:
GameState.fetch().player_data[multiplayer.get_unique_id()].chain_water_combo(1)
func _reflect_texture(p_stage: int) -> void:
_sprite.texture = load("res://assets/sprout%s.png" % p_stage)
@rpc("authority", "call_local", "reliable")
func _water_shared(sender_id: int) -> void:
if stage >= final_stage:
return
stage += 1
_sprite.texture = load("res://assets/sprout%s.png" % stage)
if sender_id != 0:
GameState.fetch().player_data[sender_id].chain_water_combo(1)
@rpc("any_peer", "call_local", "reliable")
func water(sender_id: int) -> void:
if needs_water:
needs_water = false
_water_shared.rpc(sender_id)
_need_water_drop.hide()
if sender_id != 0:
_reflect_combo.rpc_id(sender_id)
_production_timer.start()
if stage != final_stage:
needs_water = false
_production_timer.start()

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=6 format=3 uid="uid://bysgtksvovyur"]
[ext_resource type="Script" path="res://src/ingame/sprout.gd" id="1_snma1"]
[ext_resource type="Texture2D" uid="uid://d35y5ckne72qe" path="res://assets/sprout.png" id="2_ipgad"]
[ext_resource type="Texture2D" uid="uid://d35y5ckne72qe" path="res://assets/sprout1.png" id="2_ipgad"]
[ext_resource type="Texture2D" uid="uid://cwbl0r1e26eja" path="res://assets/drop.png" id="3_kghdv"]
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_rs2qp"]
@ -16,16 +16,18 @@ properties/1/replication_mode = 2
radius = 0.3
height = 0.8
[node name="Sprout" type="Node3D" node_paths=PackedStringArray("_need_water_drop", "_production_timer")]
[node name="Sprout" type="Node3D" node_paths=PackedStringArray("_need_water_drop", "_production_timer", "_sprite")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00401986, -0.00383317, 0.00119042)
script = ExtResource("1_snma1")
_need_water_drop = NodePath("NeedWaterDrop")
_production_timer = NodePath("ProductionTimer")
_sprite = NodePath("Sprite3D")
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_rs2qp")
[node name="Sprite3D" type="Sprite3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0)
pixel_size = 0.02
billboard = 2
shaded = true
@ -49,6 +51,7 @@ monitoring = false
shape = SubResource("CapsuleShape3D_cwbye")
[node name="ProductionTimer" type="Timer" parent="."]
wait_time = 5.0
one_shot = true
[connection signal="timeout" from="ProductionTimer" to="." method="_on_production_timer_timeout"]