pandemonium_demo_projects/mono/pong/Logic/CeilingFloor.cs

16 lines
306 B
C#
Raw Normal View History

using Godot;
public class CeilingFloor : Area2D
{
[Export]
private int _bounceDirection = 1;
public void OnAreaEntered(Area2D area)
{
if (area is Ball ball)
{
ball.direction = (ball.direction + new Vector2(0, _bounceDirection)).Normalized();
}
}
}