Capturing an object's x and y coordinates in a variable

william-adkins Community Member Posts: 3
Is there a way to capture an object's x and y coordinates as variables? I'm attempting to provide feedback responses to the learner based on where an object is placed using a drag-n-drop question, however I'm only able to provide two responses...a "correct" and an "incorrect". I want to provide three responses, so my thought is to subdivide either the "correct" or "incorrect" action using conditionals based on the object's x and y coordinates.

Any thoughts? Many thanks in advance!!



  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    The answer variable for a Drag and Drop question contains all pairings for all draggers and dropzones. See how it changes as I drop three objects onto three fields:
    [1-1, 2-(na), 3-(na)]
    [1-1, 2-2,    3-(na)]
    [1-1, 2-2,    3-3   ]

    So you can build conditions like "if Question_variable contains (1-2 and 2-3) do this and that". It does not tell you exact coordinates but if you add a number of drop zones here and there, you will be able to tell in which dropzone the object landed (I assume you are trying to build some type of matrix, like "drag these items onto the chart"?)
  • william-adkins
    william-adkins Community Member Posts: 3
    Thanks so much for the rapid reply, Sergey!

    I see what you're proposing, but my quandary is this....I only have one object to be placed, 4 zones to cover a particular area, and three possible feedback replies based on the zone they drop the object: (1) if the learner drags the object to zones 2 or 4, they get response #1, (2) if the learner drags the object to zone 1 they get response #2, and (3) if the they drag to zone 3, they get response #3.

    Lectora (it seems) will only allow me to provide a correct or an incorrect for that one object. I've attached a visual of the setup to help describe the issue.
  • timk
    timk Community Member Posts: 1,195 ♦ Idol ♦
    A question always needs a correct solution, but there's no need to use the information whether an answer is correct or not. Usually I'd recommend the use of action groups, but you already have that. You can add any action you want to those groups or you can use only one group and run it in both cases, correct and incorrect. I've created a dnd question with one drag item and four drop zones. Check the action group "feedback" to find the actions and their conditions.

  • william-adkins
    william-adkins Community Member Posts: 3
    Aha!! Thanks, Tim! Between your reply and Sergey's, I get it now.

    Thanks to you both!!