now only places tiles on empty tiles
This commit is contained in:
@@ -22,6 +22,7 @@ public class Player : KinematicBody2D
|
|||||||
public override void _Process(float delta)
|
public override void _Process(float delta)
|
||||||
{
|
{
|
||||||
//debug the grid
|
//debug the grid
|
||||||
|
int currentCellID = 1;
|
||||||
var tilemap = GetNode<TileMap>("/root/Main/World/Foreground");
|
var tilemap = GetNode<TileMap>("/root/Main/World/Foreground");
|
||||||
Vector2 coordinates = tilemap.WorldToMap(Position);
|
Vector2 coordinates = tilemap.WorldToMap(Position);
|
||||||
if (Input.IsKeyPressed((int)KeyList.F3))
|
if (Input.IsKeyPressed((int)KeyList.F3))
|
||||||
@@ -34,7 +35,10 @@ public class Player : KinematicBody2D
|
|||||||
}
|
}
|
||||||
if (Input.IsKeyPressed((int)KeyList.F2))
|
if (Input.IsKeyPressed((int)KeyList.F2))
|
||||||
{
|
{
|
||||||
tilemap.SetCell((int)coordinates.x, (int)coordinates.y, 1);
|
if(tilemap.GetCell((int)coordinates.x, (int)coordinates.y) == -1)
|
||||||
|
{
|
||||||
|
tilemap.SetCell((int)coordinates.x, (int)coordinates.y, currentCellID); //place offset coordinates += offset = build coordinates
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="TileSet" load_steps=10 format=2]
|
[gd_resource type="TileSet" load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/textures/cupcake.png" type="Texture" id=1]
|
[ext_resource path="res://assets/textures/cupcake.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://assets/textures/debugitem_one64.png" type="Texture" id=2]
|
[ext_resource path="res://assets/textures/debugitem_one64.png" type="Texture" id=2]
|
||||||
@@ -11,14 +11,6 @@ outlines = [ PoolVector2Array( 0, 0, 64, 0, 64, 64, 0, 64 ) ]
|
|||||||
[sub_resource type="OccluderPolygon2D" id=2]
|
[sub_resource type="OccluderPolygon2D" id=2]
|
||||||
polygon = PoolVector2Array( 0, 0, 64, 0, 64, 64, 0, 64 )
|
polygon = PoolVector2Array( 0, 0, 64, 0, 64, 64, 0, 64 )
|
||||||
|
|
||||||
[sub_resource type="ConvexPolygonShape2D" id=8]
|
|
||||||
|
|
||||||
[sub_resource type="ConvexPolygonShape2D" id=9]
|
|
||||||
points = PoolVector2Array( 0, 0, 64, 0, 64, 64, 0, 64 )
|
|
||||||
|
|
||||||
[sub_resource type="ConvexPolygonShape2D" id=10]
|
|
||||||
points = PoolVector2Array( 64, 64, 0, 64, 0, 0, 64, 0 )
|
|
||||||
|
|
||||||
[sub_resource type="NavigationPolygon" id=6]
|
[sub_resource type="NavigationPolygon" id=6]
|
||||||
vertices = PoolVector2Array( 0, 0, 64, 0, 64, 64, 0, 64 )
|
vertices = PoolVector2Array( 0, 0, 64, 0, 64, 64, 0, 64 )
|
||||||
polygons = [ PoolIntArray( 0, 1, 2, 3 ) ]
|
polygons = [ PoolIntArray( 0, 1, 2, 3 ) ]
|
||||||
@@ -40,28 +32,9 @@ polygon = PoolVector2Array( 0, 0, 64, 0, 64, 64, 0, 64 )
|
|||||||
0/navigation = SubResource( 1 )
|
0/navigation = SubResource( 1 )
|
||||||
0/shape_offset = Vector2( 0, 0 )
|
0/shape_offset = Vector2( 0, 0 )
|
||||||
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||||
0/shape = SubResource( 8 )
|
|
||||||
0/shape_one_way = false
|
0/shape_one_way = false
|
||||||
0/shape_one_way_margin = 1.0
|
0/shape_one_way_margin = 0.0
|
||||||
0/shapes = [ {
|
0/shapes = [ ]
|
||||||
"autotile_coord": Vector2( 0, 0 ),
|
|
||||||
"one_way": false,
|
|
||||||
"one_way_margin": 1.0,
|
|
||||||
"shape": SubResource( 8 ),
|
|
||||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
|
||||||
}, {
|
|
||||||
"autotile_coord": Vector2( 0, 0 ),
|
|
||||||
"one_way": false,
|
|
||||||
"one_way_margin": 1.0,
|
|
||||||
"shape": SubResource( 9 ),
|
|
||||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
|
||||||
}, {
|
|
||||||
"autotile_coord": Vector2( 0, 0 ),
|
|
||||||
"one_way": false,
|
|
||||||
"one_way_margin": 1.0,
|
|
||||||
"shape": SubResource( 10 ),
|
|
||||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
|
||||||
} ]
|
|
||||||
0/z_index = 0
|
0/z_index = 0
|
||||||
1/name = "debugitem_one64.png 1"
|
1/name = "debugitem_one64.png 1"
|
||||||
1/texture = ExtResource( 2 )
|
1/texture = ExtResource( 2 )
|
||||||
|
Reference in New Issue
Block a user