Add new components: CannotStompComponent, SkillUnlockedComponent, SpaceshipEnterComponent, SpaceshipExitComponent, SpinComponent, StompDamageComponent, StraightMotionComponent, TerrainHitFx, TooltipComponent, TrailComponent, and UnlockOnRequirementComponent
This commit is contained in:
23
scripts/components/SpinComponent.cs
Normal file
23
scripts/components/SpinComponent.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Godot;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
public partial class SpinComponent : Node
|
||||
{
|
||||
[Export] public float SpinSpeed { get; set; } = 8f;
|
||||
[Export] public Vector2 SpinDirection { get; set; } = Vector2.Right;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Spin((float)delta);
|
||||
}
|
||||
|
||||
private void Spin(float delta)
|
||||
{
|
||||
var rotationSpeed = SpinSpeed * SpinDirection.X * delta;
|
||||
if (Owner is Node2D root)
|
||||
{
|
||||
root.Rotation += rotationSpeed;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user