Add new components: ExplosiveComponent, FadeAwayComponent, FireEffectComponent, FlipComponent, GravityMotionComponent, LaunchComponent, and update PlatformMovement with LastDirection property
This commit is contained in:
24
scripts/components/LaunchComponent.cs
Normal file
24
scripts/components/LaunchComponent.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Godot;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
public partial class LaunchComponent : Node2D
|
||||
{
|
||||
[Export] public Vector2 InitialDirection { get; set; } = Vector2.Right;
|
||||
[Export] public float Speed { get; set; } = 16f;
|
||||
[Export] public Vector2 SpawnPosition { get; set; } = Vector2.Zero;
|
||||
[Export] public float SpawnRotation { get; set; } = 0f;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (Owner is not Node2D root) return;
|
||||
|
||||
root.GlobalPosition = SpawnPosition;
|
||||
root.GlobalRotation = SpawnRotation;
|
||||
}
|
||||
|
||||
public Vector2 GetInitialVelocity()
|
||||
{
|
||||
return InitialDirection.Normalized() * Speed;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user