I'm working on a story-based travel sim. Each week of travel, the player chooses how they'll go about it, such as travel speed and what activities to focus, and the week plays out with a series of randomized events based on those choices. One of the main mechanics here is the player assigning characters to specific roles for the week (security to fight off unexpected attacks, hunting to find food, diplomacy to parlay with anyone they meet, etc.).
I managed to make a (very) basic drag/drop interface for making the assignments, thanks to this forum post, and once I made some adjustments for my purposes it's worked wonders. The attached screenshots show it in action (with, again, not-even-remotely-final design or art assets), for reference. It works perfectly as it currently stands.
The issue is that there are multiple characters the player can choose to take on the journey with them. I have four programmed in right now, but will add more, and the player chooses anywhere between 1-3 of them to bring with them for the whole game. Theoretically, this should be possible, because the code for the assignments screen uses a list:
Code: Select all
$ items_list = [
{"name":"brawler", "child":"icon_brawler.png", "default_x_pos":1500, "default_y_pos":420, "x_pos":1500, "y_pos":420},
{"name":"politician", "child":"icon_politician.png", "default_x_pos":1500, "default_y_pos":740, "x_pos":1500, "y_pos":740},
{"name":"reader", "child":"icon_reader.png", "default_x_pos":1500, "default_y_pos":100, "x_pos":1500, "y_pos":100},
]
Code: Select all
draggroup:
for each_slot in slots_list:
drag:
drag_name each_slot["name"]
draggable False
child each_slot["child"]
xpos each_slot["x_pos"] ypos each_slot["y_pos"]
for each_item in items_list:
drag:
drag_name each_item["name"]
child each_item["child"]
droppable True
dragged my_dragged
xpos each_item["x_pos"] ypos each_item["y_pos"]
So in short, I need to figure out how to add items like the ones above to a list, and append.items isn't doing it. How can I make this work so I can pick characters near the beginning of the game and have the choices added to the list so they work in this drag/drop screen?