CeilingFloor.cs 314 B

12345678910111213141516
  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. }