mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-06 23:25:55 +00:00
NPC that shoots at player
This commit is contained in:
parent
bfe42b460b
commit
30850362ce
11 changed files with 253 additions and 5250 deletions
|
|
@ -1,17 +1,17 @@
|
|||
using Godot;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts;
|
||||
|
||||
public static class Tools
|
||||
{
|
||||
public static T CreateChild<T>(this Node2D node, PackedScene prefab) where T : Node2D
|
||||
{
|
||||
if (prefab == null) return null;
|
||||
var newInstance = prefab.Instantiate<T>();
|
||||
node.Owner.CallDeferred("add_child", newInstance);
|
||||
newInstance.Transform = node.GlobalTransform;
|
||||
newInstance.Position = node.Position;
|
||||
public static T CreateChild<T>(this Node2D node, PackedScene prefab) where T : Node2D
|
||||
{
|
||||
if (prefab == null) return null;
|
||||
var newInstance = prefab.Instantiate<T>();
|
||||
node.Owner.CallDeferred("add_child", newInstance);
|
||||
newInstance.Transform = node.GlobalTransform;
|
||||
newInstance.Position = node.Position;
|
||||
|
||||
return newInstance;
|
||||
}
|
||||
}
|
||||
return newInstance;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue