Code: Select all
screen flowchart():
tag menu
use game_menu(_("Flowchart")):
default nodes = [("start",(2,1))]
for node in nodes:
$ node_name = node[0]
$ xp = node[1][0]*72*2
$ yp = node[1][1]*72*2
fixed xpos xp ypos yp:
textbutton node_name action NullAction() tooltip node_name
$ tooltip = GetTooltip()
if tooltip == node_name:
frame yoffset 50:
label node_name
for connection in flowchart[node_name]["connections"]:
if connection[0] == "d":
null xsize 72 ysize 72 xpos xp ypos yp+72
$nodes.append((connection[1], (node[1][0],node[1][1]+1)))
elif connection[0] == "u":
null xsize 72 ysize 72 xpos xp ypos yp-72
$nodes.append((connection[1], (node[1][0],node[1][1]-1)))
elif connection[0] == "r":
null xsize 72 ysize 72 xpos xp+72 ypos yp
$nodes.append((connection[1], (node[1][0]+1,node[1][1])))
else:
null xsize 72 ysize 72 xpos xp-72 ypos yp
$nodes.append((connection[1], (node[1][0]-1,node[1][1])))
define flowchart = {
"start": {"label":"start", "connections":[["r","ch1"]]},
"ch1": {"label":"ch1", "connections":[["r","ch2"]]},
"ch2": {"label":"ch2", "connections":[["r","ch3"]]},
"ch3": {"label":"ch3", "connections":[["d","ch4"]]},
"ch4": {"label":"ch4", "connections":[["r","ch5A"],["d","ch5B"]]},
"ch5A": {"label":"ch5A", "connections":[["d","ch6A"],["r","ch6C"]]},
"ch5B": {"label":"ch5B", "connections":[["l","ch6B"]]},
"ch6A": {"label":"ch6A", "connections":[]},
"ch6B": {"label":"ch6B", "connections":[]},
"ch6C": {"label":"ch6C", "connections":[]},
}
Is there a way to make it not do that, aka display every button exactly once?
Or should I try a different approach entirely?