I am completely stumped as to why in this code:
MazeGenerator maze = new MazeGenerator();
var mazeTilemap = GetNode<Godot.TileMap>("/root/Game/Maze/MazeTilemap");
Vector2 posToMove = (Vector2)mazeTilemap.Call("IsTileFree",Position,direction);
Vector2 posToMove1 = maze.IsTileFree(Position,direction);
posToMove1 returns a different Vector to posToMove!
For context, MazeGenerator is the name of the script attached to my MazeTilemap node which has cell size of 32,32 and has collision on "wall" tiles. When I use mazeTilemap.Call("IsTileFree"), it returns the correct position and my character collides with the walls on the tilemap. However, when I use maze.IsTileFree(), the Vector returned is double posToMove and collision doesn't work!
I suspect when I use maze.IsTileFree() it is using a default 64,64 tilemap with no collision instead of my MazeTilemap but I don't understand why?? It doesn't make sense as to why it would do that..
Does anyone know what is going on here? What is actually happening when I create an instance of MazeGenerator and why is using that instead of a reference to the node giving me different values?