Browse Source

:fire: Remove ball kace_contact signal

DricomDragon 3 years ago
parent
commit
f27873f87f

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

@@ -1,18 +1,12 @@
 class_name Ball
 extends RigidBody2D
 
-export (Color) var interrupt_color = Color.white
-
 
-signal kace_contact
+export (Color) var interrupt_color = Color.white
 
 
-const brick_layer = 2
-const interrupt_speed = 700
-const cell_size = Vector2(20, 10)
-const max_penetration = 1.0
-const contact_corrector = cell_size - Vector2(max_penetration, max_penetration)
-const redundant_ceil = 0.9 # 0.5 < x < 1.0
+const BRICK_LAYER = 2
+const INTERRUPT_SPEED = 700
 
 
 var last_normal:Vector2 = Vector2(0.0, 0.0)
@@ -24,24 +18,9 @@ func interrupt_ball():
 
 
 func go_down_unstopped():
-	linear_velocity.y = interrupt_speed
-	linear_velocity = linear_velocity.normalized() * interrupt_speed
-	set_collision_mask_bit(brick_layer, false)
-
-
-func filter_new_contact(new_normal):
-	var is_new_contact = last_normal.dot(new_normal) < redundant_ceil
-	last_normal = new_normal
-	return is_new_contact
-
-
-func _integrate_forces(state :  Physics2DDirectBodyState):
-	for i in range(state.get_contact_count()):
-		var contact_normal = state.get_contact_local_normal(i)
-		if filter_new_contact(contact_normal):
-			var contact_pos = state.get_contact_local_position(i)
-			var correct_pos = contact_pos - contact_normal * contact_corrector
-			emit_signal("kace_contact", correct_pos)
+	linear_velocity.y = INTERRUPT_SPEED
+	linear_velocity = linear_velocity.normalized() * INTERRUPT_SPEED
+	set_collision_mask_bit(BRICK_LAYER, false)
 
 
 func _on_Launcher_interrupt_wave():

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

@@ -24,6 +24,5 @@ shape = SubResource( 1 )
 
 [node name="LifeDisplay" type="Node2D" parent="."]
 script = ExtResource( 4 )
-[connection signal="kace_damaged" from="." to="Sprite" method="_on_Brick_kace_damaged"]
 [connection signal="life_changed" from="." to="Sprite" method="_on_Brick_life_changed"]
 [connection signal="life_changed" from="." to="LifeDisplay" method="_on_Brick_life_changed"]

+ 0 - 5
godot/component/entity/launcher/Launcher.gd

@@ -7,7 +7,6 @@ signal is_full
 signal gain_new_bullet
 signal interrupt_wave
 signal move_visor
-signal kace_contact
 
 enum State {
 	READY,
@@ -69,7 +68,6 @@ func shoot():
 		bullet.linear_velocity *= BULLET_SPEED
 		add_child(bullet)
 		bullet.connect("tree_exited", self, "_on_Ball_tree_exited")
-		bullet.connect("kace_contact", self, "_on_Ball_kace_contact")
 		self.connect("interrupt_wave", bullet, "_on_Launcher_interrupt_wave")
 
 
@@ -130,6 +128,3 @@ func _on_Grid_kace_broken():
 
 func _on_DeadLine_game_lost():
 	die()
-
-func _on_Ball_kace_contact(pos: Vector2):
-	emit_signal("kace_contact", pos)

+ 0 - 1
godot/main.tscn

@@ -60,7 +60,6 @@ title = "Balls"
 [connection signal="gain_new_bullet" from="Launcher" to="UI/BallCounter" method="increase_counter"]
 [connection signal="get_firing" from="Launcher" to="UI" method="_on_Launcher_get_firing"]
 [connection signal="is_full" from="Launcher" to="Grid" method="_on_Launcher_is_full"]
-[connection signal="kace_contact" from="Launcher" to="Grid" method="_on_Ball_kace_contact"]
 [connection signal="has_moved" from="Grid" to="Launcher" method="_on_Grid_has_moved"]
 [connection signal="has_moved" from="Grid" to="DeadLine" method="_on_Grid_has_moved"]
 [connection signal="kace_broken" from="Grid" to="Launcher" method="_on_Grid_kace_broken"]