Fireball (initial implementation)
This commit is contained in:
10
Scripts/Fireball.cs
Normal file
10
Scripts/Fireball.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Fireball : CsgSphere3D
|
||||
{
|
||||
private float _speed = 80f;
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user