mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-11 04:15:53 +00:00
Navigation for enemies
This commit is contained in:
parent
13c4489017
commit
076cff208d
7 changed files with 547 additions and 297 deletions
34
Scripts/TilemapAvoidance.cs
Normal file
34
Scripts/TilemapAvoidance.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class TilemapAvoidance : TileMapLayer
|
||||
{
|
||||
|
||||
[Export] private TileMapLayer _solidLayer;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool _UseTileDataRuntimeUpdate(Vector2I coords)
|
||||
{
|
||||
if (_solidLayer.GetUsedCellsById(0).Contains(coords))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void _TileDataRuntimeUpdate(Vector2I coords, TileData tileData)
|
||||
{
|
||||
tileData.SetNavigationPolygon(0, null);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue