Browse Source

:art: Improve feedback of brick ball impact

DricomDragon 2 years ago
parent
commit
8d06b6e4b2

+ 6 - 1
godot/component/entity/ball/Ball.gd

@@ -24,6 +24,11 @@ func _on_Launcher_interrupt_wave() -> void:
 	interrupt_ball()
 
 
-func _on_Ball_body_exited(body: Node) -> void:
+func _on_Ball_body_entered(body: Node) -> void:
 	if body.has_method("impact"):
 		body.impact(position)
+
+
+func _on_Ball_body_exited(body: Node) -> void:
+	if body.has_method("bounce"):
+		body.bounce(position)

+ 1 - 0
godot/component/entity/ball/Ball.tscn

@@ -33,4 +33,5 @@ shape = SubResource( 2 )
 texture = ExtResource( 2 )
 
 [node name="Trail" parent="." instance=ExtResource( 3 )]
+[connection signal="body_entered" from="." to="." method="_on_Ball_body_entered"]
 [connection signal="body_exited" from="." to="." method="_on_Ball_body_exited"]

+ 4 - 2
godot/component/entity/brick/Brick.gd

@@ -37,6 +37,8 @@ func blow_up() -> void:
 
 
 func impact(pos: Vector2) -> void:
+	emit_signal("impact", to_local(pos))
+
+
+func bounce(pos: Vector2) -> void:
 	damage()
-	var local_pos = to_local(pos)
-	emit_signal("impact", local_pos)

+ 1 - 1
godot/component/entity/brick/Brick.tscn

@@ -35,5 +35,5 @@ shape = SubResource( 1 )
 [node name="LifeDisplay" type="Node2D" parent="."]
 script = ExtResource( 4 )
 [connection signal="impact" from="." to="MainColor/ImpactSplash" method="splash_at"]
-[connection signal="life_changed" from="." to="LifeDisplay" method="_on_Brick_life_changed"]
 [connection signal="life_changed" from="." to="MainColor" method="_on_Brick_life_changed"]
+[connection signal="life_changed" from="." to="LifeDisplay" method="_on_Brick_life_changed"]

+ 3 - 2
godot/effect/particle/impact/Impact.tscn

@@ -6,9 +6,10 @@
 
 [node name="ImpactSplash" type="Particles2D"]
 emitting = false
-lifetime = 0.5
+amount = 9
+lifetime = 0.1
 one_shot = true
-explosiveness = 1.0
+explosiveness = 0.5
 local_coords = false
 process_material = ExtResource( 2 )
 texture = ExtResource( 1 )

+ 1 - 1
godot/effect/particle/impact/ImpactMaterial.tres

@@ -10,7 +10,7 @@ curve = SubResource( 1 )
 flag_disable_z = true
 spread = 180.0
 gravity = Vector3( 0, 0, 0 )
-initial_velocity = 50.0
+initial_velocity = 300.0
 initial_velocity_random = 0.11
 angular_velocity = 100.0
 angular_velocity_random = 1.0