added debug tile placing on grid

This commit is contained in:
2022-11-13 01:44:28 +01:00
parent 69c8e437b8
commit 226f5d150c

View File

@@ -36,12 +36,17 @@ public class Player : KinematicBody2D
public override async void _Process(float delta)
{
//player coordinates on foregroundgrid
var coordinates = GetNode<TileMap>("/root/Main/World/Foreground").WorldToMap(Position);
//debug the grid
var tilemap = GetNode<TileMap>("/root/Main/World/Foreground");
Vector2 coordinates = tilemap.WorldToMap(Position);
if (Input.IsKeyPressed((int)KeyList.F3))
{
GD.Print(coordinates);
}
if (Input.IsKeyPressed((int)KeyList.F2))
{
tilemap.SetCell((int)coordinates.x, (int)coordinates.y, 1);
}
}
}