Your structure should be:
The camera's extents should be limited by the
limit properties. If you're using a
TileMap for a background this code will set those for you, just pass it a
func set_extents(tile_map:TileMap) -> void:
var tile_rect = tile_map.get_used_rect()
var cell_size = tile_map.cell_size
limit_left = tile_rect.position.x * cell_size.x
limit_top = tile_rect.position.y * cell_size.y
limit_right = tile_rect.end.x * cell_size.x
limit_bottom = tile_rect.end.y * cell_size.y
Otherwise, you can hard-code the values into that function that suit your level - or set them via the Editor.
collision_layer is set to like
Layer 1 and
collision_mask is set to like
Layer 2, and the opposite for your
StaticBody2Ds. You want the
StaticBody2Ds to have their
Layer 2 and their
Layer 1. This allows them to "see" each other in order to collide with each other.
Think of the
collision_layer as the "I am a Layer 1" and the
collision_mask as "I am looking to collide with a Layer 2"