Here is the snippet I am playing around with:
Code: Select all
init python:
def unit_clicked(name):
print "clicked on ", name
def detective_dragged(drags, drop):
if not drop:
return
store.detective = drags[0].drag_name
store.city = drop.drag_name
return True
screen send_detective_screen:
# A drag group ensures that the detectives and the cities can be
# dragged to each other.
draggroup:
# Our detectives.
drag:
drag_name "Ivy"
child "one.png"
droppable False
dragged detective_dragged
clicked unit_clicked("Ivy")
xpos 100 ypos 100
drag:
drag_name "Zack"
child "one.png"
droppable False
dragged detective_dragged
clicked unit_clicked("Zack")
xpos 150 ypos 100
# The cities they can go to.
drag:
drag_name "London"
child "two.png"
draggable False
xpos 450 ypos 140
drag:
drag_name "Paris"
draggable False
child "two.png"
xpos 500 ypos 280
label start:
"We need to investigate! Who should we send, and where should they go?"
call screen send_detective_screen
"Okay, we'll send [detective] to [city]."
Code: Select all
clicked on Ivy
clicked on Zach
If I'm not using the clicked event properly, what's a good way to call a function with parameters after the drag item has been clicked?