added remove tile debug key and made better background collisison

This commit is contained in:
2022-11-13 20:09:33 +01:00
parent 855ba9f0e2
commit a16f599a56
3 changed files with 49 additions and 44 deletions

View File

@@ -12,3 +12,4 @@ script = ExtResource( 3 )
[node name="World" parent="." instance=ExtResource( 2 )]
[node name="Player" parent="." instance=ExtResource( 1 )]
speed = 600

View File

@@ -28,6 +28,10 @@ public class Player : KinematicBody2D
{
GD.Print(coordinates);
}
if (Input.IsKeyPressed((int)KeyList.F1))
{
tilemap.SetCell((int)coordinates.x, (int)coordinates.y, -1);
}
if (Input.IsKeyPressed((int)KeyList.F2))
{
tilemap.SetCell((int)coordinates.x, (int)coordinates.y, 1);

View File

@@ -3,40 +3,40 @@
[ext_resource path="res://assets/textures/test_background_tileset.png" type="Texture" id=1]
[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 512, 512, 480, 512, 480, 0, 512, 0 )
[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 512, 512, 480, 512, 480, 32, 512, 32 )
points = PoolVector2Array( 512, 512, 448, 512, 448, 0, 512, 0 )
[sub_resource type="ConvexPolygonShape2D" id=3]
points = PoolVector2Array( 512, 32, 0, 32, 0, 0, 512, 0 )
points = PoolVector2Array( 512, 64, 0, 64, 0, 0, 512, 0 )
[sub_resource type="ConvexPolygonShape2D" id=4]
points = PoolVector2Array( 512, 32, 0, 32, 0, 0, 512, 0 )
[sub_resource type="ConvexPolygonShape2D" id=5]
points = PoolVector2Array( 0, 0, 512, 0, 512, 32, 0, 32 )
points = PoolVector2Array( 512, 64, 0, 64, 0, 0, 512, 0 )
[sub_resource type="ConvexPolygonShape2D" id=6]
points = PoolVector2Array( 0, 32, 32, 32, 32, 512, 0, 512 )
points = PoolVector2Array( 0, 0, 64, 0, 64, 512, 0, 512 )
[sub_resource type="ConvexPolygonShape2D" id=7]
points = PoolVector2Array( 32, 512, 0, 512, 0, 0, 32, 0 )
points = PoolVector2Array( 64, 512, 0, 512, 0, 0, 64, 0 )
[sub_resource type="ConvexPolygonShape2D" id=8]
points = PoolVector2Array( 512, 512, 0, 512, 0, 480, 512, 480 )
[sub_resource type="ConvexPolygonShape2D" id=9]
points = PoolVector2Array( 32, 512, 0, 512, 0, 0, 32, 0 )
points = PoolVector2Array( 512, 512, 0, 512, 0, 448, 512, 448 )
[sub_resource type="ConvexPolygonShape2D" id=10]
points = PoolVector2Array( 32, 480, 512, 480, 512, 512, 32, 512 )
[sub_resource type="ConvexPolygonShape2D" id=11]
points = PoolVector2Array( 512, 512, 480, 512, 480, 0, 512, 0 )
points = PoolVector2Array( 0, 448, 512, 448, 512, 512, 0, 512 )
[sub_resource type="ConvexPolygonShape2D" id=12]
points = PoolVector2Array( 480, 512, 0, 512, 0, 480, 480, 480 )
points = PoolVector2Array( 512, 512, 0, 512, 0, 448, 512, 448 )
[sub_resource type="ConvexPolygonShape2D" id=13]
points = PoolVector2Array( 512, 512, 448, 512, 448, 64, 512, 64 )
[sub_resource type="ConvexPolygonShape2D" id=14]
points = PoolVector2Array( 512, 64, 64, 64, 64, 0, 512, 0 )
[sub_resource type="ConvexPolygonShape2D" id=15]
points = PoolVector2Array( 64, 448, 0, 448, 0, 0, 64, 0 )
[sub_resource type="ConvexPolygonShape2D" id=16]
points = PoolVector2Array( 512, 448, 448, 448, 448, 0, 512, 0 )
[resource]
0/name = "test_background_tileset.png 0"
@@ -71,12 +71,6 @@ points = PoolVector2Array( 480, 512, 0, 512, 0, 480, 480, 480 )
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 2 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 3 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
@@ -89,12 +83,6 @@ points = PoolVector2Array( 480, 512, 0, 512, 0, 480, 480, 480 )
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 5 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 6 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
@@ -113,25 +101,37 @@ points = PoolVector2Array( 480, 512, 0, 512, 0, 480, 480, 480 )
"autotile_coord": Vector2( 0, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 9 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 10 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 11 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 12 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 13 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 14 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 15 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 16 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0