fix de l'intro et de l'actualisation de score
This commit is contained in:
parent
33fce0e0ab
commit
d3ea21e212
@ -17,7 +17,7 @@ var size = PlanetData.DEFAULT_GARDEN_SIZE
|
|||||||
func _init(_planet_data : PlanetData, _initial_plants : Array[Plant] = []):
|
func _init(_planet_data : PlanetData, _initial_plants : Array[Plant] = []):
|
||||||
planet_data = _planet_data
|
planet_data = _planet_data
|
||||||
plants = _initial_plants
|
plants = _initial_plants
|
||||||
update_garden_score()
|
# update_garden_score()
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
contamination_sprite = generate_contamination_terrain_sprite()
|
contamination_sprite = generate_contamination_terrain_sprite()
|
||||||
@ -26,7 +26,7 @@ func _ready():
|
|||||||
for p in plants:
|
for p in plants:
|
||||||
p.harvested.connect(_on_plant_harvested)
|
p.harvested.connect(_on_plant_harvested)
|
||||||
p.state_changed.connect(_on_plant_state_changed)
|
p.state_changed.connect(_on_plant_state_changed)
|
||||||
update_garden_score()
|
# update_garden_score()
|
||||||
|
|
||||||
func generate_contamination_terrain_sprite() -> Polygon2D:
|
func generate_contamination_terrain_sprite() -> Polygon2D:
|
||||||
if not planet_data.garden_contamination:
|
if not planet_data.garden_contamination:
|
||||||
@ -69,6 +69,9 @@ func plant(
|
|||||||
planet_data.score_by_plant.append(0)
|
planet_data.score_by_plant.append(0)
|
||||||
new_plant.harvested.connect(_on_plant_harvested)
|
new_plant.harvested.connect(_on_plant_harvested)
|
||||||
new_plant.state_changed.connect(_on_plant_state_changed)
|
new_plant.state_changed.connect(_on_plant_state_changed)
|
||||||
|
new_plant.ready.connect(
|
||||||
|
func(): update_garden_score()
|
||||||
|
)
|
||||||
return new_plant
|
return new_plant
|
||||||
|
|
||||||
func _on_plant_state_changed(_p: Plant):
|
func _on_plant_state_changed(_p: Plant):
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
viewport_path = NodePath("SubViewport")
|
viewport_path = NodePath("SubViewport")
|
||||||
|
|
||||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_6yuhi"]
|
[sub_resource type="FastNoiseLite" id="FastNoiseLite_6yuhi"]
|
||||||
seed = 1530088909
|
seed = 263046432
|
||||||
frequency = 1.0
|
frequency = 1.0
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7a1qq"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7a1qq"]
|
||||||
@ -51,7 +51,7 @@ adjustment_saturation = 0.88
|
|||||||
|
|
||||||
[node name="TitleScreen" type="CanvasLayer"]
|
[node name="TitleScreen" type="CanvasLayer"]
|
||||||
script = ExtResource("1_6yuhi")
|
script = ExtResource("1_6yuhi")
|
||||||
game_scene_path = "uid://d28cp7a21kwou"
|
game_scene_path = "uid://d0n52psuns1vl"
|
||||||
|
|
||||||
[node name="Background1" type="TextureRect" parent="."]
|
[node name="Background1" type="TextureRect" parent="."]
|
||||||
z_index = -1
|
z_index = -1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user