You have two options. If you add a CollisionShape2D child, you can add your new shape to it. Otherwise, you have to use the collision/shape_owner API, which I think is more cumbersome to use.
Example:
var collision = CollisionShape2D.new()
new_platform.add_child(collision)
var shape = RectangleShape2D.new()
shape.extents = Vector2(5 * PlatformSize, 1))
collision.shape = shape
add_child(new_platform)
See CollisionObject2D docs for details of the shape_owner
API. You might also find it easier if you create a default platform scene that includes a collision shape and instance that, so that you only have to set the shape extents.
You didn't mention what error add_child()
was giving you, so I'm not sure what to advise about that.