CeilingFloor.cs 314 B

123456789101112131415
  1. using Godot;
  2. public partial class CeilingFloor : Area2D
  3. {
  4. [Export]
  5. private int _bounceDirection = 1;
  6. public void OnAreaEntered(Area2D area)
  7. {
  8. if (area is Ball ball)
  9. {
  10. ball.direction = (ball.direction + new Vector2(0, _bounceDirection)).Normalized();
  11. }
  12. }
  13. }