Pong/Scripts/SceneManager.cs
Fries 4200a3e7df add enemy ai to the game
the enemy can now track the player with a cast that uses a shape generated in code. the enemy moves using some fancy math that gets the sign of the distance between the ball and the enemy paddles y position to get a normalised number for velocity and the velocity is lerped to smooth out any janky movement.
2023-05-17 23:41:40 -07:00

14 lines
229 B
C#

using Godot;
namespace Pong.Scripts;
public partial class SceneManager : Node2D
{
public override void _Process(double delta)
{
if (Input.IsActionJustPressed("scene_reload"))
{
GetTree().ReloadCurrentScene();
}
}
}