This commit is contained in:
Steven Long
2023-07-15 16:28:28 -07:00
parent 615847e96e
commit 02674dc005
6 changed files with 11 additions and 10 deletions

View File

@@ -1,9 +1,7 @@
using Godot;
public partial class Blizzard : Projectile
{
public override void _PhysicsProcess(double delta)
{
Translate(new Vector3(0, 0, -Speed));
Translate(new Godot.Vector3(0, 0, Speed * (float)delta));
}
}

View File

@@ -1,9 +1,7 @@
using Godot;
public partial class Fireball : Projectile
{
public override void _PhysicsProcess(double delta)
{
Translate(new Vector3(0, 0, -Speed));
Translate(new Godot.Vector3(0, 0, Speed * (float)delta));
}
}

View File

@@ -19,6 +19,7 @@ public partial class Player : CharacterBody3D
private Node3D _cameraMount;
private Node3D _pivot;
private Node3D _camera;
private PackedScene _weaponType;
// Get the _gravity from the project settings to be synced with RigidBody nodes.
@@ -28,6 +29,7 @@ public partial class Player : CharacterBody3D
{
Input.MouseMode = Input.MouseModeEnum.Captured;
_cameraMount = GetNode<Node3D>("/root/Main/Player/CameraMount");
_camera = GetNode<Node3D>("/root/Main/Player/CameraMount/Camera");
_pivot = GetNode<Node3D>("/root/Main/Player/Pivot");
_weaponType = _projectiles.First();
}
@@ -56,6 +58,7 @@ public partial class Player : CharacterBody3D
GD.Print("Shoot");
var projectile = _weaponType.Instantiate<Node3D>();
projectile.Position = Position;
projectile.Rotation = Rotation;
GetParent().AddChild(projectile);
}