Fireball (initial implementation)

This commit is contained in:
2023-07-14 18:19:13 -07:00
parent 1eac5d4301
commit 9fe56cd75f
10 changed files with 159 additions and 1 deletions

10
Scripts/Fireball.cs Normal file
View File

@@ -0,0 +1,10 @@
using Godot;
public partial class Fireball : CsgSphere3D
{
private float _speed = 80f;
public override void _PhysicsProcess(double delta)
{
}
}

View File

@@ -30,6 +30,12 @@ public partial class Player : CharacterBody3D
{
if (Input.IsActionJustPressed("quit"))
GetTree().Quit();
if (Input.IsActionJustPressed("shoot"))
Shoot();
}
public override void _Input(InputEvent @event)
{
}
public override void _PhysicsProcess(double delta)
@@ -41,6 +47,14 @@ public partial class Player : CharacterBody3D
MoveAndSlide();
}
private void Shoot()
{
GD.Print("Shoot");
var projectile = new Fireball();
Owner.AddChild(projectile);
projectile.Transform = Transform;
}
private Vector3 CalculateMovement(Vector3 velocity, Transform3D transform, float gravityDelta)
{
if (!IsOnFloor())