Follow Drag and Drop messaging

eldiablo

  • Posts: 23
I was wondering how would I go about implementing a trigger on "Follow Drag and Drop" behaviors mouse press/release on scene level. I am trying to do a jigsaw puzzle game and am using the fore mentioned behavior to do drag and drop.
I need to do some processing after the puzzle piece pickup and dropping, but am lost on best way to do this. I was trying a few different ways about this, for example i had a mouse press/release events on scene level that were scanning the actors for "Follow Drag and Drop" behavior then checking the "_Grabbed" attribute for status and then doing the processing for the ones with the "_Grabbed" flag set to true.
This however didnt quite work as there seemed to be some issues with updating as only the release event found "_Grabbed" to be true for one actor. Probably the press event fires on the scene level before the actor behavior sets the "_Grabbed" to true.

eldiablo

  • Posts: 23
I solved this by using "Dragged" event instead of "Release" on scene level for now. Its not the way I would program this in a usual programming scenario, but it works for now.

captaincomic

  • *
  • Posts: 6108
You could modify the Follow Drag and Drop behavior and insert triggers at the points where the Dragged attribute gets set to true/false.

eldiablo

  • Posts: 23
I intended to do just that but couldn't find a way to trigger events at scene level. I probably didn't look hard enough.

captaincomic

  • *
  • Posts: 6108
There are blocks "trigger event _ in all behaviors for this scene" and "trigger event _ in behavior _ for this scene". Maybe that's what you need.