complete refactor
This commit is contained in:
parent
65fe0e5c5d
commit
de2e8b1e50
71 changed files with 212 additions and 137 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using Godot;
|
||||
|
||||
namespace Newlon.Components.Droppables;
|
||||
|
||||
public partial class DropMover : Node
|
||||
{
|
||||
public float ySpeed = -200.0f;
|
||||
|
|
@ -16,7 +18,7 @@ public partial class DropMover : Node
|
|||
stop_y = ((parent.GlobalPosition / FieldParams.Tile).Ceil() * FieldParams.Tile).Y;
|
||||
gravity = (float)ProjectSettings.GetSetting("physics/2d/default_gravity");
|
||||
|
||||
velocity = new Vector2((GD.Randf()-0.5f)*xSpeed,ySpeed);
|
||||
velocity = new Vector2((GD.Randf() - 0.5f) * xSpeed, ySpeed);
|
||||
}
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
|
|
@ -25,6 +27,6 @@ public partial class DropMover : Node
|
|||
velocity += Vector2.Down * gravity * (float)delta;
|
||||
|
||||
parent.GlobalPosition += velocity * (float)delta;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
|
||||
namespace Newlon.Components.Droppables;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class DroppableItem : Area2D
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using Godot;
|
||||
using Newlon;
|
||||
using Newlon.Resources;
|
||||
|
||||
namespace Newlon.Components.Droppables;
|
||||
|
||||
public partial class DroppableSeedpacket : DroppableItem
|
||||
{
|
||||
|
|
@ -11,10 +13,10 @@ public partial class DroppableSeedpacket : DroppableItem
|
|||
{
|
||||
_cost.Text = plant.Cost.ToString();
|
||||
_icon.Texture = plant.Preview;
|
||||
if (plant.customFrame != null)
|
||||
if (plant.CustomFrame != null)
|
||||
{
|
||||
_packet.Texture = plant.customFrame.frame;
|
||||
_cost.LabelSettings = plant.customFrame.font;
|
||||
_packet.Texture = plant.CustomFrame.frame;
|
||||
_cost.LabelSettings = plant.CustomFrame.font;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue