New kinematicbody physics and objects now have scenes

This commit is contained in:
Luke Hubmayer-Werner 2020-04-19 19:24:58 +09:30
parent 45a2c1ad87
commit 23da8b01c4
10 changed files with 321 additions and 174 deletions

141
Main.tscn

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,9 @@
[ext_resource path="res://spritesheet.png" type="Texture" id=1] [ext_resource path="res://spritesheet.png" type="Texture" id=1]
[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
[sub_resource type="ConvexPolygonShape2D" id=2] [sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
@ -33,10 +36,10 @@ points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
[sub_resource type="ConvexPolygonShape2D" id=12] [sub_resource type="ConvexPolygonShape2D" id=12]
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 )
[sub_resource type="ConvexPolygonShape2D" id=13] [sub_resource type="ConvexPolygonShape2D" id=13]
points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 ) points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
[sub_resource type="ConvexPolygonShape2D" id=14] [sub_resource type="ConvexPolygonShape2D" id=14]
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
@ -96,13 +99,13 @@ points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
[sub_resource type="ConvexPolygonShape2D" id=33] [sub_resource type="ConvexPolygonShape2D" id=33]
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 )
[sub_resource type="ConvexPolygonShape2D" id=34] [sub_resource type="ConvexPolygonShape2D" id=34]
points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 ) points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 )
[sub_resource type="ConvexPolygonShape2D" id=35] [sub_resource type="ConvexPolygonShape2D" id=35]
points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 ) points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
[sub_resource type="ConvexPolygonShape2D" id=36] [sub_resource type="ConvexPolygonShape2D" id=36]
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
@ -149,9 +152,6 @@ points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
[sub_resource type="ConvexPolygonShape2D" id=50] [sub_resource type="ConvexPolygonShape2D" id=50]
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 ) points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
[sub_resource type="ConvexPolygonShape2D" id=51]
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
[resource] [resource]
1/name = "Floor" 1/name = "Floor"
1/texture = ExtResource( 1 ) 1/texture = ExtResource( 1 )
@ -186,308 +186,308 @@ points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
3/navigation_offset = Vector2( 0, 0 ) 3/navigation_offset = Vector2( 0, 0 )
3/shape_offset = Vector2( 0, 0 ) 3/shape_offset = Vector2( 0, 0 )
3/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) 3/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
3/shape = SubResource( 2 ) 3/shape = SubResource( 1 )
3/shape_one_way = false 3/shape_one_way = false
3/shape_one_way_margin = 1.0 3/shape_one_way_margin = 1.0
3/shapes = [ { 3/shapes = [ {
"autotile_coord": Vector2( 0, 0 ), "autotile_coord": Vector2( 0, 0 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 2 ), "shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 1, 0 ), "autotile_coord": Vector2( 1, 0 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 3 ), "shape": SubResource( 2 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 2, 0 ), "autotile_coord": Vector2( 2, 0 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 4 ), "shape": SubResource( 3 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 3, 0 ), "autotile_coord": Vector2( 3, 0 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 5 ), "shape": SubResource( 4 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 4, 0 ), "autotile_coord": Vector2( 4, 0 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 6 ), "shape": SubResource( 5 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 5, 0 ), "autotile_coord": Vector2( 5, 0 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 7 ), "shape": SubResource( 6 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 6, 0 ), "autotile_coord": Vector2( 6, 0 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 8 ), "shape": SubResource( 7 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 7, 0 ), "autotile_coord": Vector2( 7, 0 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 9 ), "shape": SubResource( 8 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 8, 0 ), "autotile_coord": Vector2( 8, 0 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 10 ), "shape": SubResource( 9 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 0, 1 ), "autotile_coord": Vector2( 0, 1 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 11 ), "shape": SubResource( 10 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 1, 1 ), "autotile_coord": Vector2( 1, 1 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 12 ), "shape": SubResource( 11 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 2, 1 ), "autotile_coord": Vector2( 2, 1 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 13 ), "shape": SubResource( 12 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 3, 1 ), "autotile_coord": Vector2( 3, 1 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 14 ), "shape": SubResource( 13 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 4, 1 ), "autotile_coord": Vector2( 4, 1 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 15 ), "shape": SubResource( 14 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 5, 1 ), "autotile_coord": Vector2( 5, 1 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 16 ), "shape": SubResource( 15 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 6, 1 ), "autotile_coord": Vector2( 6, 1 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 17 ), "shape": SubResource( 16 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 7, 1 ), "autotile_coord": Vector2( 7, 1 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 18 ), "shape": SubResource( 17 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 8, 1 ), "autotile_coord": Vector2( 8, 1 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 19 ), "shape": SubResource( 18 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 0, 2 ), "autotile_coord": Vector2( 0, 2 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 20 ), "shape": SubResource( 19 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 1, 2 ), "autotile_coord": Vector2( 1, 2 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 21 ), "shape": SubResource( 20 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 2, 2 ), "autotile_coord": Vector2( 2, 2 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 22 ), "shape": SubResource( 21 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 3, 2 ), "autotile_coord": Vector2( 3, 2 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 23 ), "shape": SubResource( 22 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 4, 2 ), "autotile_coord": Vector2( 4, 2 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 24 ), "shape": SubResource( 23 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 5, 2 ), "autotile_coord": Vector2( 5, 2 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 25 ), "shape": SubResource( 24 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 6, 2 ), "autotile_coord": Vector2( 6, 2 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 26 ), "shape": SubResource( 25 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 7, 2 ), "autotile_coord": Vector2( 7, 2 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 27 ), "shape": SubResource( 26 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 8, 2 ), "autotile_coord": Vector2( 8, 2 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 28 ), "shape": SubResource( 27 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 0, 3 ), "autotile_coord": Vector2( 0, 3 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 29 ), "shape": SubResource( 28 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 1, 3 ), "autotile_coord": Vector2( 1, 3 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 30 ), "shape": SubResource( 29 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 2, 3 ), "autotile_coord": Vector2( 2, 3 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 31 ), "shape": SubResource( 30 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 3, 3 ), "autotile_coord": Vector2( 3, 3 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 32 ), "shape": SubResource( 31 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 4, 3 ), "autotile_coord": Vector2( 4, 3 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 33 ), "shape": SubResource( 32 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 5, 3 ), "autotile_coord": Vector2( 5, 3 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 34 ), "shape": SubResource( 33 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 6, 3 ), "autotile_coord": Vector2( 6, 3 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 35 ), "shape": SubResource( 34 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 7, 3 ), "autotile_coord": Vector2( 7, 3 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 36 ), "shape": SubResource( 35 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 8, 3 ), "autotile_coord": Vector2( 8, 3 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 37 ), "shape": SubResource( 36 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 0, 4 ), "autotile_coord": Vector2( 0, 4 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 38 ), "shape": SubResource( 37 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 1, 4 ), "autotile_coord": Vector2( 1, 4 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 39 ), "shape": SubResource( 38 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 2, 4 ), "autotile_coord": Vector2( 2, 4 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 40 ), "shape": SubResource( 39 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 3, 4 ), "autotile_coord": Vector2( 3, 4 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 41 ), "shape": SubResource( 40 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 4, 4 ), "autotile_coord": Vector2( 4, 4 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 42 ), "shape": SubResource( 41 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 5, 4 ), "autotile_coord": Vector2( 5, 4 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 43 ), "shape": SubResource( 42 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 6, 4 ), "autotile_coord": Vector2( 6, 4 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 44 ), "shape": SubResource( 43 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 0, 5 ), "autotile_coord": Vector2( 0, 5 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 45 ), "shape": SubResource( 44 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 1, 5 ), "autotile_coord": Vector2( 1, 5 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 46 ), "shape": SubResource( 45 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 2, 5 ), "autotile_coord": Vector2( 2, 5 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 47 ), "shape": SubResource( 46 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 3, 5 ), "autotile_coord": Vector2( 3, 5 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 48 ), "shape": SubResource( 47 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 4, 5 ), "autotile_coord": Vector2( 4, 5 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 49 ), "shape": SubResource( 48 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 5, 5 ), "autotile_coord": Vector2( 5, 5 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 50 ), "shape": SubResource( 49 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, { }, {
"autotile_coord": Vector2( 6, 5 ), "autotile_coord": Vector2( 6, 5 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 51 ), "shape": SubResource( 50 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ] } ]
3/z_index = 0 3/z_index = 0

16
item.gd
View File

@ -34,22 +34,6 @@ func _process(delta):
direction += dir_vectors[get_belt_direction(vec.x, vec.y)] * foot_weights[i] direction += dir_vectors[get_belt_direction(vec.x, vec.y)] * foot_weights[i]
position += direction/total_weight * belt_speed position += direction/total_weight * belt_speed
# var vec = beltmap.world_to_map(position)
# if stuck_vec:
# if get_rect().intersects(get_belt_rect(stuck_vec)):
# position += dir_vectors[stuck_dir] * belt_speed
# return
# else:
# stuck_vec = null
# stuck_dir = -1
# var tx = vec[0]
# var ty = vec[1]
# if beltmap.get_cell(tx, ty) >= 0:
# stuck_dir = get_belt_direction(tx, ty)
# stuck_vec = vec
# position += dir_vectors[stuck_dir] * belt_speed
func _input(event): func _input(event):
if event is InputEventMouseButton: if event is InputEventMouseButton:

84
kb2dladder.gd Normal file
View File

@ -0,0 +1,84 @@
extends KinematicBody2D
var held = false
var grabbed_vector = null
onready var beltmap = $"../BeltTiles"
var dir_vectors = [Vector2(1,0), Vector2(0,-1), Vector2(-1,0), Vector2(0,1)]
const max_speed := 200
export var rungs := 13
export var cx := 2.0 # offset for edge feet
export var cy := 5.0 # offset for edge feet
var foot_vectors
var foot_weights
var total_weight
#var stuck_vec = null
#var stuck_dir = -1 # For going off the end of belts
func _ready():
total_weight = 1 + rungs*4
foot_vectors = [Vector2(0, 0)]
foot_weights = [3]
for i in rungs:
foot_vectors.append(Vector2(cx*(i+1), cy))
foot_vectors.append(Vector2(-cx*(i+1), cy))
foot_vectors.append(Vector2(cx*(i+1), -cy))
foot_vectors.append(Vector2(-cx*(i+1), -cy))
foot_weights.append(1)
foot_weights.append(1)
foot_weights.append(1)
foot_weights.append(1)
func get_belt_direction(tx, ty):
var xflip = beltmap.is_cell_x_flipped(tx, ty)
var tp = beltmap.is_cell_transposed(tx, ty)
return int(tp) + int(xflip)*2
func get_belt_rect(vec):
var origin = beltmap.map_to_world(vec)
return Rect2(to_local(origin), Vector2(8, 8))
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
var belt_speed = 8
var direction = Vector2(0, 0)
for i in len(foot_vectors):
var vec = beltmap.world_to_map(position + foot_vectors[i].rotated(rotation))
if beltmap.get_cell(vec.x, vec.y) >= 0:
direction += dir_vectors[get_belt_direction(vec.x, vec.y)] * foot_weights[i]
direction /= total_weight*0.5
direction.x = clamp(direction.x, -1, 1)
direction.y = clamp(direction.y, -1, 1)
move_and_slide(direction * belt_speed)
if held: # Cursor drag code
var ggv = to_global(grabbed_vector)
var dv = get_global_mouse_position() - ggv
var dvn = dv.normalized()
var dvm = dv.length()
var velo = dvn * min(dvm*dvm, max_speed)
# move_and_slide(dvn * min(dvm*dvm, max_speed)) # Simple movement
var collision = move_and_collide(velo*delta)
if collision and collision.remainder.length_squared()>0:
if collision.collider is KinematicBody2D:
var col2 = collision.collider.move_and_collide(collision.remainder)
if col2 and col2.remainder.length_squared()>0:
if col2.collider is KinematicBody2D:
col2.collider.move_and_collide(col2.remainder)
collision.collider.move_and_collide(col2.remainder)
move_and_collide(col2.remainder)
move_and_collide(collision.remainder)
else:
move_and_collide(collision.remainder.slide(collision.normal))
func _input(event):
if event is InputEventMouseButton:
if not event.pressed:
held = false
elif $sprite.get_rect().has_point(to_local(event.position)):
held = true
grabbed_vector = to_local(event.position)

21
objects/BigLadder.tscn Normal file
View File

@ -0,0 +1,21 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://kb2dladder.gd" type="Script" id=1]
[ext_resource path="res://assets/sprites/iron_ladder4.tres" type="Texture" id=2]
[node name="BigLadder" type="KinematicBody2D"]
input_pickable = true
script = ExtResource( 1 )
[node name="CS2D" type="CollisionPolygon2D" parent="."]
polygon = PoolVector2Array( -24, -7, -24, 7, 24, 7, 24, -7 )
__meta__ = {
"_edit_lock_": true
}
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )
region_rect = Rect2( 80, 240, 32, 16 )
__meta__ = {
"_edit_lock_": true
}

24
objects/IronOre.tscn Normal file
View File

@ -0,0 +1,24 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://kb2dladder.gd" type="Script" id=1]
[ext_resource path="res://assets/sprites/iron_ore.tres" type="Texture" id=2]
[node name="IronOre" type="KinematicBody2D"]
input_pickable = true
script = ExtResource( 1 )
rungs = 1
cx = 3.0
cy = 3.0
[node name="CS2D" type="CollisionPolygon2D" parent="."]
polygon = PoolVector2Array( -3, -3, -3, 3, 3, 3, 3, -3 )
__meta__ = {
"_edit_lock_": true
}
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )
region_rect = Rect2( 80, 240, 32, 16 )
__meta__ = {
"_edit_lock_": true
}

24
objects/IronRod.tscn Normal file
View File

@ -0,0 +1,24 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://kb2dladder.gd" type="Script" id=1]
[ext_resource path="res://assets/sprites/iron_rod.tres" type="Texture" id=2]
[node name="IronRod" type="KinematicBody2D"]
input_pickable = true
script = ExtResource( 1 )
rungs = 3
cx = 2.35
cy = 2.0
[node name="CS2D" type="CollisionPolygon2D" parent="."]
polygon = PoolVector2Array( -7, -2, -7, 2, 7, 2, 7, -2 )
__meta__ = {
"_edit_lock_": true
}
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )
region_rect = Rect2( 80, 240, 32, 16 )
__meta__ = {
"_edit_lock_": true
}

24
objects/IronStock.tscn Normal file
View File

@ -0,0 +1,24 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://kb2dladder.gd" type="Script" id=1]
[ext_resource path="res://assets/sprites/iron_stock.tres" type="Texture" id=2]
[node name="IronStock" type="KinematicBody2D"]
input_pickable = true
script = ExtResource( 1 )
rungs = 3
cx = 2.35
cy = 3.0
[node name="CS2D" type="CollisionPolygon2D" parent="."]
polygon = PoolVector2Array( -7, -3, -7, 3, 7, 3, 7, -3 )
__meta__ = {
"_edit_lock_": true
}
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )
region_rect = Rect2( 80, 240, 32, 16 )
__meta__ = {
"_edit_lock_": true
}

22
objects/MedLadder.tscn Normal file
View File

@ -0,0 +1,22 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://kb2dladder.gd" type="Script" id=1]
[ext_resource path="res://assets/sprites/iron_ladder2.tres" type="Texture" id=2]
[node name="MedLadder" type="KinematicBody2D"]
input_pickable = true
script = ExtResource( 1 )
rungs = 7
[node name="CS2D" type="CollisionPolygon2D" parent="."]
polygon = PoolVector2Array( -12, -7, -12, 7, 12, 7, 12, -7 )
__meta__ = {
"_edit_lock_": true
}
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )
region_rect = Rect2( 80, 240, 32, 16 )
__meta__ = {
"_edit_lock_": true
}

23
objects/SmallLadder.tscn Normal file
View File

@ -0,0 +1,23 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://kb2dladder.gd" type="Script" id=1]
[ext_resource path="res://assets/sprites/iron_ladder.tres" type="Texture" id=2]
[node name="SmallLadder" type="KinematicBody2D"]
input_pickable = true
script = ExtResource( 1 )
rungs = 3
cx = 2.35
[node name="CS2D" type="CollisionPolygon2D" parent="."]
polygon = PoolVector2Array( -7, -7, -7, 7, 7, 7, 7, -7 )
__meta__ = {
"_edit_lock_": true
}
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )
region_rect = Rect2( 80, 240, 32, 16 )
__meta__ = {
"_edit_lock_": true
}