@@ -496,7 +496,7 @@ func make_layer(layer, parent, root, data):
496
496
497
497
var is_tile_object = tileset .tile_get_region (tile_id ).get_area () == 0
498
498
var collisions = tileset .tile_get_shape_count (tile_id )
499
- var has_collisions = collisions > 0 && object . has ( "type" ) && object . type != "sprite"
499
+ var has_collisions = collisions > 0
500
500
var sprite = Sprite .new ()
501
501
var pos = Vector2 ()
502
502
var rot = 0
@@ -526,11 +526,15 @@ func make_layer(layer, parent, root, data):
526
526
527
527
var obj_root = sprite
528
528
if has_collisions :
529
- match object .type :
530
- "area" : obj_root = Area2D .new ()
531
- "kinematic" : obj_root = KinematicBody2D .new ()
532
- "rigid" : obj_root = RigidBody2D .new ()
533
- _ : obj_root = StaticBody2D .new ()
529
+ if object .has ("type" ):
530
+ match object .type :
531
+ "area" : obj_root = Area2D .new ()
532
+ "kinematic" : obj_root = KinematicBody2D .new ()
533
+ "rigid" : obj_root = RigidBody2D .new ()
534
+ "one-way" : obj_root = StaticBody2D .new ()
535
+ _ : obj_root = StaticBody2D .new ()
536
+ else :
537
+ obj_root = StaticBody2D .new ()
534
538
535
539
object_layer .add_child (obj_root )
536
540
obj_root .owner = root
@@ -546,12 +550,15 @@ func make_layer(layer, parent, root, data):
546
550
collision_node .transform = s .shape_transform
547
551
if sprite .flip_h :
548
552
collision_node .position .x *= - 1
549
- collision_node .position .x - = cell_size .x
553
+ collision_node .position .x + = cell_size .x
550
554
collision_node .scale .x *= - 1
551
555
if sprite .flip_v :
552
556
collision_node .scale .y *= - 1
553
557
collision_node .position .y *= - 1
558
+ else :
554
559
collision_node .position .y -= cell_size .y
560
+ if object .has ("type" ) && object .type == "one-way" :
561
+ collision_node .one_way_collision = true
555
562
obj_root .add_child (collision_node )
556
563
collision_node .owner = root
557
564
0 commit comments