// Called when the EnvironNode2D enters the scene tree for the first time. public override void _Ready() { Player = this.GetNode <PlayerKinematicBody2D>("OnGround/PlayerKinematicBody2D"); PlayerBag = this.GetNode <Inventory>("CanvasLayer/Inventory"); foreach (var zombie in this.Zombies) { zombie.TargetNode = this.Player; } // Listen to inventory click event. PlayerBag.Connect("CellClicked", this, "OnCellClicked"); // Setup crosshair on the mouse icon. Input.SetDefaultCursorShape(Input.CursorShape.Cross); }
public override void _Process(float delta) { this.player = this.GetNode <EnvironNode2D>("/root/EnvironNode2D").Player; // TODO figure out a way not to do this - very inefficient (can't put it in ready due to order of ready call) }