7-19-25 @ 1:16 AM

This commit is contained in:
2025-07-19 01:16:38 -04:00
parent 3884c07811
commit ea03cc152a
7 changed files with 137 additions and 59 deletions

View File

@@ -3,18 +3,22 @@ using System;
public partial class ActorPanel : Panel
{
public bool _hovered = false;
public Actor _actor;
public static ActorPanel _Create(Actor ACTOR)
{
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/actor_panel.tscn");
ActorPanel newActorPanel = scene.Instantiate<ActorPanel>();
newActorPanel.SetSprite(ACTOR.Texture);
newActorPanel.SetMax(ACTOR._healthMax);
newActorPanel.SetValue(ACTOR._health);
newActorPanel.SetPosition(new Vector2(1500, 0));
newActorPanel._actor = ACTOR;
newActorPanel.SetSprite(newActorPanel._actor.GetNode<Sprite2D>("Sprite").Texture);
newActorPanel.SetMax(newActorPanel._actor._healthMax);
newActorPanel.SetValue(newActorPanel._actor._health);
newActorPanel.SetPosition(new Vector2(50, 300));
return newActorPanel;
}
public void SetPosition(Vector2 POSITION)
{
Position = POSITION;
@@ -25,12 +29,24 @@ public partial class ActorPanel : Panel
}
public void SetValue(int VALUE)
{
GetNode<Node2D>("Health").GetNode<RichTextLabel>("Value").Text = VALUE.ToString();
GetNode<Node2D>("Health").GetNode<ProgressBar>("Bar").Value = VALUE;
GetNode<Control>("Health").GetNode<RichTextLabel>("Value").Text = VALUE.ToString();
GetNode<Control>("Health").GetNode<ProgressBar>("Bar").Value = VALUE;
}
public void SetMax(int MAX)
{
GetNode<Node2D>("Health").GetNode<RichTextLabel>("Max").Text = MAX.ToString();
GetNode<Node2D>("Health").GetNode<ProgressBar>("Bar").MaxValue = MAX;
GetNode<Control>("Health").GetNode<RichTextLabel>("Max").Text = MAX.ToString();
GetNode<Control>("Health").GetNode<ProgressBar>("Bar").MaxValue = MAX;
}
private void OnMouseEntered()
{
_hovered = true;
GD.Print(_hovered);
}
private void OnMouseExited()
{
_hovered = false;
GD.Print(_hovered);
}
}