How can I open a circular platform at random places ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Anand
:warning: Old Version Published before Godot 3 was released.

I m making a game in which player runs inside a circle , and the circle opens at random places , I need some help to open the circle at random places .

Your help shall be highly appreciated !

There could be many ways to do that.
How did you make player runs inside a circle?

volzhs | 2016-07-31 13:25

:bust_in_silhouette: Reply From: Scipi

You could make it so each segment of the circle has an id associated with it. Each segment could live under a parent with a script attached that takes an id, and calls open() on whichever child has that id. In code, that might look like:

var segments = {}

func _ready():
    for c in get_children():
        if "id" in c:
            segments[] = c

func open_segment(id):

func open_rand_segment():
    var i = rand_range(0, segments.size())

Of course, this varies greatly depending on implementation details.