🎉 Initial Commit
✨ Grid system, player movement etc
This commit is contained in:
30
Scripts/Tiles/BaseTile.cs
Normal file
30
Scripts/Tiles/BaseTile.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Godot;
|
||||
|
||||
namespace AceFieldNewHorizon.Scripts.Tiles;
|
||||
|
||||
public partial class BaseTile : Node2D
|
||||
{
|
||||
protected CollisionShape2D CollisionShape;
|
||||
protected Sprite2D Sprite;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
// Get references (optional: you can also Export and assign in editor)
|
||||
CollisionShape = GetNode<CollisionShape2D>("CollisionShape2D");
|
||||
Sprite = GetNode<Sprite2D>("Sprite2D");
|
||||
}
|
||||
|
||||
public void SetGhostMode(bool ghost)
|
||||
{
|
||||
if (CollisionShape != null)
|
||||
CollisionShape.Disabled = ghost;
|
||||
|
||||
if (Sprite != null)
|
||||
{
|
||||
if (ghost)
|
||||
Sprite.Modulate = new Color(1, 1, 1, 0.5f); // semi-transparent
|
||||
else
|
||||
Sprite.Modulate = Colors.White;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user