Fries
4200a3e7df
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.
14 lines
229 B
C#
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();
|
|
}
|
|
}
|
|
}
|