More World Generation, more Camera, other stuff.

This commit is contained in:
gdz
2025-08-08 19:39:33 +02:00
parent 802918e5b8
commit b429afcb81
22 changed files with 382 additions and 334 deletions

View File

@@ -1,5 +1,7 @@
using Godot;
using System;
using Ecosystem.utility;
namespace Ecosystem.scenes.entities;
public partial class BaseEntity : Area2D
{
@@ -8,6 +10,8 @@ public partial class BaseEntity : Area2D
[Signal]
public delegate BaseEntity EntityDeselectedEventHandler();
public Data.EntityData _data;
protected Vector2 ScreenSize;
protected AnimationPlayer animationPlayer;
@@ -16,7 +20,8 @@ public partial class BaseEntity : Area2D
protected bool selected;
protected Label positionLabel;
public override void _Ready()
{
ScreenSize = GetViewportRect().Size;
@@ -24,6 +29,8 @@ public partial class BaseEntity : Area2D
sprite = GetNode<Sprite2D>("Sprite2D");
collisionShape = GetNode<CollisionShape2D>("CollisionShape2D");
animationPlayer = sprite.GetNode<AnimationPlayer>("AnimationPlayer");
positionLabel = GetNode<Label>("MarginContainer/VBoxContainer/Label2");
}
public override void _UnhandledInput(InputEvent @event)
@@ -45,6 +52,12 @@ public partial class BaseEntity : Area2D
}
}
public override void _Process(double delta)
{
if (selected)
positionLabel.Text = $"Position: {Position.ToString("F0")}";
}
protected void entitySelected()
{
selected = true;
@@ -71,11 +84,9 @@ public partial class BaseEntity : Area2D
{
MarginContainer marginContainer = GetNode<MarginContainer>("MarginContainer");
Label nameLabel = GetNode<Label>("MarginContainer/VBoxContainer/Label");
Label positionLabel = GetNode<Label>("MarginContainer/VBoxContainer/Label2");
nameLabel.Text = $"Name: {Name}";
positionLabel.Text = $"Position: {Position}";
marginContainer.Show();
}

View File

@@ -1,7 +1,7 @@
using Godot;
using System;
public partial class Bumblebee : BaseEntity
public partial class Bumblebee : Ecosystem.scenes.entities.BaseEntity
{
private FastNoiseLite fastNoise = new FastNoiseLite();

View File

@@ -1,7 +1,8 @@
using Godot;
using System;
using Math = Ecosystem.utility.Math;
namespace Ecosystem.scenes.entities.fly;
public partial class Fly : BaseEntity
{
[Export] public float _tx = 0;
@@ -59,6 +60,7 @@ public partial class Fly : BaseEntity
public override void _Process(double delta)
{
base._Process(delta);
step();
}
}
}