Ball.gd 549 B

1234567891011121314151617181920212223242526
  1. class_name Ball
  2. extends RigidBody2D
  3. signal kace_contact
  4. const brick_layer = 2
  5. const interrupt_speed = 500
  6. func go_down_unstopped():
  7. linear_velocity.y = interrupt_speed
  8. linear_velocity = linear_velocity.normalized() * interrupt_speed
  9. set_collision_mask_bit(brick_layer, false)
  10. func _integrate_forces(state : Physics2DDirectBodyState):
  11. for i in range(state.get_contact_count()):
  12. var contact_pos = state.get_contact_local_position(i)
  13. emit_signal("kace_contact", contact_pos)
  14. func _on_Launcher_interrupt_wave():
  15. go_down_unstopped()